A method declares a type parameter that it never uses

tx0/java:idle-type-parameterrecommendedwarningsmell

What it finds

<T> void clear() declares a type parameter that no parameter, result or body refers to. It constrains nothing, callers may supply it for no reason, and readers look for a use that is not there.

Reported is a type parameter of a method whose name appears nowhere else in the method.

From the rule's source, unused_type_parameter.rs.

Example from the rule's tests
import java.util.List; class Lists {  <T> void clear(List<?> items) {tx0 reports: T is never used    items.clear();  }   <T> T first(List<T> items) {    return items.get(0);  }}
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 recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/java:idle-type-parameter" = "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:idle-type-parameter] reason="..."

tx0 explain tx0/java:idle-type-parameter shows the same in the terminal. Found a false positive? Report it.