-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run recent JDK tests on JDK 21 #834
Changes from 3 commits
cacadbe
4ecb46e
3f64acf
2ee89d6
a9ca068
4003737
f65a1c0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,6 +25,7 @@ | |
import com.uber.nullaway.NullAway; | ||
import java.util.Arrays; | ||
import org.junit.Before; | ||
import org.junit.Ignore; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.TemporaryFolder; | ||
|
@@ -174,4 +175,30 @@ public void testSwitchExprLambda() { | |
"}") | ||
.doTest(); | ||
} | ||
|
||
@Ignore | ||
@Test | ||
public void testSwitchExprNullCase() { | ||
defaultCompilationHelper | ||
.addSourceLines( | ||
"SwitchExpr.java", | ||
"package com.uber;", | ||
"import javax.annotation.Nullable;", | ||
"class SwitchExpr {", | ||
" public enum NullableEnum {", | ||
" a,", | ||
" b,", | ||
" }", | ||
" // NOTE: we should report a bug here for nullableEnum but cannot do so until", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually thinking more this is not true; if there is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm saying that NullAway should not report an NPE here, because there will be no NPE if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's correct, I misunderstood your comment. I added the comment for NullAway not reporting without null, as we discussed previously, but in this context i can either omit it entirely or mention that it only applies when null case isn't defined. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, I misunderstood before. I went ahead and deleted the comment. |
||
" // Error Prone supports matching switch expressions", | ||
" static Object handleNullableEnum(@Nullable NullableEnum nullableEnum) {", | ||
" return switch (nullableEnum) {", | ||
" case a -> new Object();", | ||
" case b -> new Object();", | ||
" case null -> throw new IllegalArgumentException(\"NullableEnum parameter is required\");", | ||
" };", | ||
" }", | ||
"}") | ||
.doTest(); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment indicating we are ignoring because of a crash in the dataflow library