TypeParameterQualifier
Type parameter used as type qualifier

Category
Severity
ERROR
Maturity

The problem

Using a type parameter as a qualifier in the name of a type or expression is equivalent to referencing the type parameter’s upper bound directly.

For example, this signature:

static <T extends Message> T populate(T.Builder builder) {}

Is identical to the following:

static <T extends Message> T populate(Message.Builder builder) {}

The use of T.Builder is unnecessary and misleading, so referring to the type by its canonical name should always be preferred.

Suppression

Suppress false positives by adding an @SuppressWarnings("TypeParameterQualifier") annotation to the enclosing element.