Suspicious 'Class.getClass()' call
Reports getClass()
methods that are called on a java.lang.Class
instance.
This is usually a mistake as the result is always equivalent to Class.class
. If it's a mistake, then it's better to remove the getClass()
call and use the qualifier directly. If the behavior is intended, then it's better to write Class.class
explicitly to avoid confusion.
Example:
After one of the possible quick-fixes is applied:
Locating this inspection
- By ID
Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.
ClassGetClass- Via Settings dialog
Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.
New in 2018.2
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 243.23126 |