A method declares a type parameter with the name of a type parameter of its class

tx0/java:type-parameter-hides-outerstrictwarningsmell

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.

Example from the rule's tests
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;  }}
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: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.