Raw use of parameterized class
Reports generic classes with omitted type parameters. Such raw use of generic types is valid in Java, but it defeats the purpose of type parameters and may mask bugs. This inspection mirrors the rawtypes
warning of javac
.
Examples:
Configure the inspection:
Use the Ignore construction of new objects option to ignore raw types used in object construction.
Use the Ignore type casts option to ignore raw types used in type casts.
Use the Ignore where a type parameter would not compile option to ignore the cases when a type parameter fails to compile (for example, when creating an array or overriding a library method).
Use the Ignore parameter types of overriding methods option to ignore type parameters used in parameters of overridden methods.
Use the Ignore when automatic quick-fix is not available option to ignore the cases when a quick-fix is not available.
This inspection only reports if the language level of the project or module is 5 or higher.
Inspection options
Option | Type | Default |
---|---|---|
Ignore construction of new objects | Checkbox | false |
Ignore type casts | Checkbox | false |
Ignore where a type parameter would not compile | Checkbox | true |
Ignore parameter types of overriding methods | Checkbox | false |
Ignore when automatic quick-fix is not available | Checkbox | false |
Inspection Details | |
---|---|
Available in: | IntelliJ IDEA 2023.3, Qodana for JVM 2023.3 |
Plugin: | Java, 233.SNAPSHOT |