The arguments of a call are variables named like the method's parameters, but in a different order
What it finds
resize(height, width) on void resize(int width, int height) compiles because both are int, and swaps the two. When every argument is named after a parameter, a different order is almost always a mistake.
Reported is a call, without receiver or on this, of a method declared once in the same class with at least two parameters, whose arguments are simple names that are a reordering of the parameter names.
From the rule's source, swapped_arguments.rs.
class Shapes { void resize(int width, int height) {} void run(int width, int height) { resize(height, width);tx0 reports: in another order resize(width, height); resize(width, width); }} 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:
[rules]
"tx0/java:swapped-arguments" = "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:swapped-arguments] reason="..."tx0 explain tx0/java:swapped-arguments shows the same in the terminal. Found a false positive? Report it.