A method declares a type parameter with the name of a type parameter of its class
What it finds
In class Box<T> { <T> T unwrap(T other) } the method's T hides the class's T, so inside the method T is a different type that only shares the name. It is usually meant to be the class's type parameter, and declaring it again breaks the link.
Reported is a type parameter of a method with the name of a type parameter of an enclosing class.
From the rule's source, type_parameter_hides_outer.rs.
class Box<T> { <T> T unwrap(T other) {tx0 reports: hides the type parameter of the class return other; } <U> U map(U other) { return other; }} 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:type-parameter-hides-outer" = "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:type-parameter-hides-outer] reason="..."tx0 explain tx0/java:type-parameter-hides-outer shows the same in the terminal. Found a false positive? Report it.