Skip to content

Commit

Permalink
Added test
Browse files Browse the repository at this point in the history
  • Loading branch information
armughan11 committed Jun 9, 2024
1 parent 3498074 commit 11e8c81
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions nullaway/src/test/java/com/uber/nullaway/CoreTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,29 @@ public void arrayIndexUnbox() {
.doTest();
}

@Test
public void arrayAccessDataflowTest() {
defaultCompilationHelper
.addSourceLines(
"Test.java",
"package com.uber;",
"import javax.annotation.Nullable;",
"class Test {",
" static class Foo {",
" @Nullable String f;",
" }",
" static Foo[] arr = new Foo[10];",
" static void fizz() {",
" int i = 0;",
" if (arr[i].f != null) {",
" //TODO: This should raise an error in non-JSpecify mode",
" arr[i].f.toString();",
" }",
" }",
"}")
.doTest();
}

@Test
public void cfNullableArrayField() {
defaultCompilationHelper
Expand Down

0 comments on commit 11e8c81

Please sign in to comment.