-
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
JSpecify: fix crash with calls to static methods #856
Changes from 3 commits
25963a9
ffb680e
fff179d
f04f43c
0d1c44f
54bc881
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 |
---|---|---|
|
@@ -1494,12 +1494,40 @@ public void interactionWithContracts() { | |
.doTest(); | ||
} | ||
|
||
@Test | ||
public void testForGuavaRawTypeBuildIssue() { | ||
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. Rather than pulling in Guava here, let's just test for the core issue of static method calls of the form 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 agree. I have changed the test case to reproduce this scenario without using importing guava and ImmutableSet. Let me know if this works. I have removed the helper which imports guava too. |
||
makeHelperWithGuava() | ||
.addSourceLines( | ||
"Test.java", | ||
"package com.uber;", | ||
"import org.jspecify.annotations.Nullable;", | ||
"import com.google.common.collect.ImmutableSet;", | ||
"class Test {", | ||
" static void funcImmutableSet(ImmutableSet<Object> is){", | ||
" }", | ||
" static void testNegative() {", | ||
" funcImmutableSet(ImmutableSet.of());", | ||
" }", | ||
" static void testNegative2() {", | ||
" funcImmutableSet(ImmutableSet.of(new Object()));", | ||
" }", | ||
"}") | ||
.doTest(); | ||
} | ||
|
||
private CompilationTestHelper makeHelper() { | ||
return makeTestHelperWithArgs( | ||
Arrays.asList( | ||
"-XepOpt:NullAway:AnnotatedPackages=com.uber", "-XepOpt:NullAway:JSpecifyMode=true")); | ||
} | ||
|
||
private CompilationTestHelper makeHelperWithGuava() { | ||
return makeTestHelperWithArgs( | ||
Arrays.asList( | ||
"-XepOpt:NullAway:AnnotatedPackages=com.uber,com.google.common", | ||
"-XepOpt:NullAway:JSpecifyMode=true")); | ||
} | ||
|
||
private CompilationTestHelper makeHelperWithoutJSpecifyMode() { | ||
return makeTestHelperWithArgs(Arrays.asList("-XepOpt:NullAway:AnnotatedPackages=com.uber")); | ||
} | ||
|
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.
Now that I think of it, let's not add this change here, and instead do it in a separate follow-up PR, just to make things cleaner
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.
Makes sense, I have removed it from this branch.