diff --git a/nullaway/src/test/java/com/uber/nullaway/NullAwayJSpecifyGenericsTests.java b/nullaway/src/test/java/com/uber/nullaway/NullAwayJSpecifyGenericsTests.java index fca16016ab..5727a074ba 100644 --- a/nullaway/src/test/java/com/uber/nullaway/NullAwayJSpecifyGenericsTests.java +++ b/nullaway/src/test/java/com/uber/nullaway/NullAwayJSpecifyGenericsTests.java @@ -205,9 +205,11 @@ public void nestedGenericTypes() { " abstract R apply(P p);", " }", " }", - " static void positiveParam(Wrapper<@Nullable String>.Fn p1) {", - " // BUG: Diagnostic contains: Cannot assign from type Test.Wrapper<@Nullable String>.Fn to type Test.Wrapper.Fn", - " Wrapper.Fn p2 = p1;", + " static void param(@Nullable Wrapper.Fn p) {}", + " static void positiveParam() {", + " Wrapper<@Nullable String>.Fn x = null;", + " // BUG: Diagnostic contains: Cannot pass parameter of type Test.Wrapper<@Nullable String>.Fn", + " param(x);", " }", " static void positiveAssign() {", " Wrapper<@Nullable String>.Fn p1 = null;", @@ -219,6 +221,18 @@ public void nestedGenericTypes() { " // BUG: Diagnostic contains: Cannot return expression of type Test.Wrapper<@Nullable String>.Fn", " return p1;", " }", + " static void negativeParam() {", + " Wrapper.Fn x = null;", + " param(x);", + " }", + " static void negativeAssign() {", + " Wrapper<@Nullable String>.Fn p1 = null;", + " Wrapper<@Nullable String>.Fn p2 = p1;", + " }", + " static @Nullable Wrapper<@Nullable String>.Fn negativeReturn() {", + " Wrapper<@Nullable String>.Fn p1 = null;", + " return p1;", + " }", "}") .doTest(); } @@ -1058,7 +1072,7 @@ public void overrideExplicitlyTypedAnonymousClass() { @Ignore("https://github.com/uber/NullAway/issues/836") @Test - public void anonymousNestedClasses() { + public void overrideAnonymousNestedClass() { makeHelper() .addSourceLines( "Test.java",