A method declares a type parameter that it never uses
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.
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); }} 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:
[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.