Inspectopedia Help

Redundant 'isInstance()' or 'cast()' call

Reports redundant calls of java.lang.Class methods.

For example, Xyz.class.isInstance(object) can be replaced with object instanceof Xyz. The instanceof check is preferred: even though the performance will probably be the same as these methods are intrinsics, they better indicate a static check.

New in 2018.2

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023