Use short-circuit boolean operators

Proprietary

Replaces a boolean & with && and | with || where both forms provably evaluate the same, adding parentheses where the lower precedence of the new operator would otherwise regroup the expression, so a && b | c becomes a && (b || c). It leaves an expression alone when an operand is of unknown type, when an operand after the first is a Boolean other than Boolean.TRUE, Boolean.FALSE or Boolean.valueOf(..) of a literal, calls a method, assigns or may throw, or when a pattern variable would change scope.

io.moderne.staticanalysis.UseShortCircuitBooleanOperator
mod run . --recipe=io.moderne.staticanalysis.UseShortCircuitBooleanOperator

Install it once from Recipe actions, then run it on every repository under the current directory. New to the Moderne CLI? Set it up.