A compliant solution:
Boolean b = …; if ( b != null ) doSometing( b ? “a” : “b” ); // Should be ok, now reports an issue
Created from community feedback: https://community.sonarsource.com/t/java-s5411-boxed-booleans-are-ok-to-be-used-if-null-checked-before/32464
- relates to
-
RSPEC-5411 Boxed "Boolean" should be avoided in boolean expressions
- Active