Skip to content

Commit

Permalink
add a multi-level inner type test
Browse files Browse the repository at this point in the history
  • Loading branch information
msridhar committed Jan 2, 2023
1 parent f43a69a commit 6e26322
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion nullaway/src/test/java/com/uber/nullaway/NullAwayCoreTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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();
}
}

0 comments on commit 6e26322

Please sign in to comment.