A generic JDK type is used without type arguments

tx0/java:generic-without-argumentsstrictwarningsmell

What it finds

List names = new ArrayList<>() uses the raw type List: the compiler then checks nothing about what goes in or comes out, and every read needs a cast that can fail at run time.

Reported are the generic collection types of java.util and a few other generic JDK types written without type arguments in declarations. Class literals, instanceof, casts and method references are left alone, since raw types are what they take or common there.

From the rule's source, raw_type.rs.

Example from the rule's tests
import java.util.ArrayList;import java.util.List;import java.util.Map; class Store {  List names = new ArrayList<String>();tx0 reports: List is used without type arguments  Map<String, List<String>> index;   boolean check(Object o) {    return o instanceof List;  }   Class<?> type() {    return List.class;  }}
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:generic-without-arguments" = "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:generic-without-arguments] reason="..."

tx0 explain tx0/java:generic-without-arguments shows the same in the terminal. Found a false positive? Report it.