False-positives are pointed out in other SO posts (1 & 2), where nulls are involved across functions and procedures.
I feel my situation is not as complicated.
// A and B are both Double[]
if (A.length == 1 || (B != null && B.length == 1)) {
Double vol;
if (A.length == 1) {
vol = A[0];
} else {
vol = B[0]; // Sonar Blocker: Null pointers should not be deferenced
}
}
I could've fixed this by changing else to else if (B != null && B.length == 1), but doing so rewards me with warning "condition(B != null && B.length == 1) is always true".
Did I miss something here?