Skip to content

Commit 6fa9e4b

Browse files
committed
another test
1 parent 61e60da commit 6fa9e4b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2084,6 +2084,24 @@ public void issue1126() {
20842084
" Supplier<? extends @Nullable Object> s = () -> null;",
20852085
" }",
20862086
"}")
2087+
.addSourceLines(
2088+
"Test2.java",
2089+
"package com.uber;",
2090+
"import java.util.HashMap;",
2091+
"import java.util.Map;",
2092+
"import org.jspecify.annotations.Nullable;",
2093+
"import org.jetbrains.annotations.Contract;",
2094+
"public class Test2 {",
2095+
" @Contract(\"null -> true\")",
2096+
" public static boolean isEmpty(@Nullable Map<?, ? extends @Nullable Object> map) {",
2097+
" return (map == null || map.isEmpty());",
2098+
" }",
2099+
" static void foo() {",
2100+
" Map<String, @Nullable Object> variables = new HashMap<>();",
2101+
" if (isEmpty(variables)) { /* do nothing */ }",
2102+
" variables.toString();",
2103+
" }",
2104+
"}")
20872105
.doTest();
20882106
}
20892107

0 commit comments

Comments
 (0)