The condition of a conditional expression is negated, where swapping the branches reads plainer

tx0/java:negated-ternary-conditionstrictwarningstyle

What it finds

!done ? wait() : finish() makes the reader undo the negation to find which branch runs when; done ? finish() : wait() says the same directly.

Reported is a conditional expression whose condition is a ! or a != comparison.

From the rule's source, negated_ternary_condition.rs.

Example from the rule's tests
class Pick {  String pick(boolean done, int a, int b) {    String x = !done ? "wait" : "finish";tx0 reports: a negated condition    String y = a != b ? "differ" : "same";tx0 reports: a negated condition    String z = done ? "finish" : "wait";    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:negated-ternary-condition" = "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:negated-ternary-condition] reason="..."

tx0 explain tx0/java:negated-ternary-condition shows the same in the terminal. Found a false positive? Report it.