Boolean conditions are joined with & or | instead of && or ||, so both sides always run

tx0/java:non-short-circuit-logicstrictwarningbug

What it finds

if (user != null & user.isActive()) evaluates both sides, so it throws a NullPointerException for a null user; && would stop after the first. With booleans, & and | always evaluate their right operand, which is rarely what a condition means.

Reported is & or | between two operands of type boolean, as this file shows, whose right operand calls a method or compares.

From the rule's source, non_short_circuit_logic.rs.

Example from the rule's tests
class Checks {  boolean check(String user, boolean a, boolean b) {    boolean x = user != null & user.isEmpty();tx0 reports: always evaluates both sides; && stops early    boolean y = a | user.isBlank();tx0 reports: || stops early    boolean z = a & b;    return x || y || z;  }}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/java:non-short-circuit-logic" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/java:non-short-circuit-logic] reason="..."

tx0 explain tx0/java:non-short-circuit-logic shows the same in the terminal. Found a false positive? Report it.