-
Notifications
You must be signed in to change notification settings - Fork 322
Open
Description
Test case:
NullAway/nullaway/src/test/java/com/uber/nullaway/jspecify/GenericMethodTests.java
Lines 1061 to 1080 in fed9143
| @Test | |
| public void genericMethodLambdaArgWildCard() { | |
| makeHelperWithInferenceFailureWarning() | |
| .addSourceLines( | |
| "Test.java", | |
| "import org.jspecify.annotations.*;", | |
| "import java.util.function.Function;", | |
| "@NullMarked", | |
| "class Test {", | |
| " static <T, R> R invokeWithReturn(Function <? super T, ? extends @Nullable R> mapper) {", | |
| " throw new RuntimeException();", | |
| " }", | |
| " static void test() {", | |
| " // legal, should infer R -> Object but then the type of the lambda as ", | |
| " // Function<Object, @Nullable Object> via wildcard upper bound", | |
| " Object x = invokeWithReturn(t -> null);", | |
| " }", | |
| "}") | |
| .doTest(); | |
| } |
This reflects the suppression in Spring here. Since this comes up often, ideally we would find a way to get rid of this false positive without adding full support for wildcards.
Metadata
Metadata
Assignees
Labels
No labels