Skip to content

Commit

Permalink
Add test for #1011 (#1018)
Browse files Browse the repository at this point in the history
We can enable the test on appropriate JDK versions once
openjdk/jdk#20460 lands. #1011
  • Loading branch information
msridhar authored Aug 11, 2024
1 parent e6839dd commit b37f5f9
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.google.errorprone.CompilationTestHelper;
import com.uber.nullaway.NullAwayTestsBase;
import java.util.Arrays;
import org.junit.Ignore;
import org.junit.Test;

public class BytecodeGenericsTests extends NullAwayTestsBase {
Expand Down Expand Up @@ -222,6 +223,25 @@ public void overrideReturnTypes() {
.doTest();
}

@Test
@Ignore("Failing due to https://bugs.openjdk.org/browse/JDK-8337795")
// TODO Re-enable this test once the JDK bug is fixed, on appropriate JDK versions
// See https://github.com/uber/NullAway/issues/1011
public void callMethodTakingJavaUtilFunction() {
makeHelper()
.addSourceLines(
"Test.java",
"package com.uber;",
"import org.jspecify.annotations.Nullable;",
"import com.uber.lib.generics.JavaUtilFunctionMethods;",
"class Test {",
" static void testNegative() {",
" JavaUtilFunctionMethods.withFunction(s -> { return null; });",
" }",
"}")
.doTest();
}

private CompilationTestHelper makeHelper() {
return makeTestHelperWithArgs(
Arrays.asList(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.uber.lib.generics;

import java.util.function.Function;
import org.jspecify.annotations.Nullable;

public class JavaUtilFunctionMethods {

public static void withFunction(Function<String, @Nullable String> f) {}
}

0 comments on commit b37f5f9

Please sign in to comment.