diff --git a/nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java b/nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java index d3683cb302..869f736790 100644 --- a/nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java +++ b/nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java @@ -1886,16 +1886,20 @@ public void intersectionTypeInvalidAssign() { "public class Test {", " interface A {}", " static class B implements A<@Nullable String>, Serializable {}", + " static class C implements A, Serializable {}", " static void test1(Object o) {", " var x = (A & Serializable) o;", " // BUG: Diagnostic contains: Cannot assign from type B to type A & Serializable", " x = new B();", + " // ok", + " x = new C();", " }", - " static class C implements A, Serializable {}", " static void test2(Object o) {", " var x = (A<@Nullable String> & Serializable) o;", - // TODO: this assignment should be an error but we do not compute annotations in the - // type of x correctly + // TODO: should _not_ be an error, see https://github.com/uber/NullAway/issues/1022 + " // BUG: Diagnostic contains: Cannot assign from type B to type A & Serializable", + " x = new B();", + // TODO: _should_ be an error, see https://github.com/uber/NullAway/issues/1022 " x = new C();", " }", "}")