mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-10 18:09:38 +07:00
IDEA-299423 NPE false positive in static analysis involving collection emptiness check GitOrigin-RevId: c15b5117e0c58ebbe5617d221db66ecf969f5204
20 lines
744 B
Java
20 lines
744 B
Java
// IDEA-299423
|
|
import java.util.*;
|
|
|
|
class Test {
|
|
private static void exampleThree() {
|
|
final Queue<String> queue1 = new ArrayDeque<>(List.of("foo1", "bar1"));
|
|
final Queue<String> queue2 = new ArrayDeque<>(List.of("foo2", "bar2"));
|
|
final Queue<String> queue3 = new ArrayDeque<>(List.of("foo3", "bar3"));
|
|
|
|
if(!queue1.isEmpty() && !queue2.isEmpty() && !queue3.isEmpty()) {
|
|
final String poll1 = queue1.poll();
|
|
final String poll2 = queue2.poll();
|
|
final String poll3 = queue3.poll();
|
|
// NPE warning for poll2.getBytes() and poll3.getBytes() because poll2 and poll3 might be null
|
|
if (poll1.getBytes().length == poll2.getBytes().length || poll3.getBytes().length != 0) {
|
|
// ...
|
|
}
|
|
}
|
|
}
|
|
} |