The single untyped parameter of a lambda is put in parentheses
What it finds
(item) -> item.size() puts a single parameter without a type in parentheses that the language does not need: item -> item.size() says the same. The fix removes them.
From the rule's source, lambda_param_parens.rs.
import java.util.function.BiFunction;import java.util.function.Function; class Mapping { Function<String, Integer> a = (s) -> s.length();tx0 reports: (s) needs no parentheses Function<String, Integer> b = s -> s.length(); Function<String, Integer> c = (String s) -> s.length(); BiFunction<String, String, String> d = (x, y) -> x + y;} 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:lambda-param-parens" = "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:lambda-param-parens] reason="..."tx0 explain tx0/java:lambda-param-parens shows the same in the terminal. Found a false positive? Report it.