Skip to content
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

Add test for #1011 #1018

Merged
merged 4 commits into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {}
}