Java: Add nullness test covering known FP.

This commit is contained in:
Anders Schack-Mulligen
2026-02-23 09:21:05 +01:00
parent bdbbd45909
commit 2b8e719034
2 changed files with 20 additions and 0 deletions

View File

@@ -557,4 +557,23 @@ public class B {
if (n > 100) s.hashCode(); // OK
if (n == 42) s.hashCode(); // OK
}
public void testFinally2(int[] xs) {
String s = null;
int i = 0;
while (true) {
try {
int x = xs[i++];
if (x == 0) {
s = "foo";
break;
} else if (x == 1) {
continue;
}
} finally {
}
}
s.hashCode(); // Spurious NPE - false positive
// CFG reachability does not distinguish abrupt successors
}
}