diff --git a/nullaway/src/test/java/com/uber/nullaway/NullAwayCoreTests.java b/nullaway/src/test/java/com/uber/nullaway/NullAwayCoreTests.java index 5c9df89f45..5e6d0ec06f 100644 --- a/nullaway/src/test/java/com/uber/nullaway/NullAwayCoreTests.java +++ b/nullaway/src/test/java/com/uber/nullaway/NullAwayCoreTests.java @@ -1083,7 +1083,6 @@ public void typeUseAnnotationOnArray() { .addSourceLines( "Test.java", "package com.uber;", - "import java.util.Set;", "import org.checkerframework.checker.nullness.qual.Nullable;", "class Test {", " // ok only for backwards compat", @@ -1100,4 +1099,24 @@ public void typeUseAnnotationOnArray() { "}") .doTest(); } + + @Test + public void typeUseAnnotationOnInnerMultiLevel() { + defaultCompilationHelper + .addSourceLines( + "Test.java", + "package com.uber;", + "import java.util.Set;", + "import org.checkerframework.checker.nullness.qual.Nullable;", + "class A { class B { class C {} } }", + "class Test {", + " // At some point, we should only treat the last of these declarations", + " // as making the field @Nullable. For now, any of them makes the field", + " // @Nullable.", + " @Nullable A.B.C foo1 = null;", + " A.@Nullable B.C foo2 = null;", + " A.B.@Nullable C foo3 = null;", + "}") + .doTest(); + } }