Skip to content

Commit

Permalink
one more test
Browse files Browse the repository at this point in the history
  • Loading branch information
mauricioaniche committed Sep 29, 2024
1 parent 5d8157d commit 2623bfa
Showing 1 changed file with 27 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,33 @@ public void semanticIssue_combinationOfExpressionAndLiteralBoolean() {
.doTest();
}

@Test
public void noSemanticIssue_combinationOfExpressionAndLiteralBoolean() {
defaultCompilationHelper
.addSourceLines(
"Foo.java",
"package com.uber;",
"import javax.annotation.Nullable;",
"import com.uber.nullaway.annotations.EnsuresNonNullIf;",
"class Foo {",
" @Nullable Item nullableItem;",
" @EnsuresNonNullIf(value=\"nullableItem\", result=true)",
" public boolean hasNullableItem() {",
" return true && nullableItem != null;",
" }",
" public int runOk() {",
" if(!hasNullableItem()) {",
" return 1;",
" }",
" nullableItem.call();",
" return 0;",
" }",
"}")
.addSourceLines(
"Item.java", "package com.uber;", "class Item {", " public void call() { }", "}")
.doTest();
}

@Test
public void semanticIssues_methodDeclarationReversed() {
defaultCompilationHelper
Expand Down

0 comments on commit 2623bfa

Please sign in to comment.