Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSpecify: Handle @Nonnull elements in @Nullable content arrays #963

Merged
merged 17 commits into from
Jun 18, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added test
  • Loading branch information
armughan11 committed Jun 9, 2024
commit 11e8c816b410c714b5e2db330bd802b38710a3d7
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
Loading