void (@NotNull PsiInstanceOfExpression expression) { super.visitInstanceOfExpression(expression); final PsiTypeElement checkTypeElement = expression.getCheckType(); if (checkTypeElement == null) { return; } final PsiType checkType = checkTypeElement.getType(); if (!(checkType instanceof PsiClassType checkClassType)) { return; } final PsiExpression operand = expression.getOperand(); final PsiType operandType = operand.getType(); if (!(operandType instanceof PsiClassType operandClassType)) { return; } if (DfaPsiUtil.isAssertionEffectively(expression, false)) { return; } if (!TypeConversionUtil.areTypesConvertible(operandClassType, checkType)) { return; // don't warn on uncompilable code } final PsiClass checkClass = checkClassType.resolve(); if (checkClass == null) { return; } final PsiClass operandClass = operandClassType.resolve(); if (operandClass == null) { return; } final String operandClassName = operandClass.getName(); if (operandClassName == null) { return; } ThreeState hasMutualSubclass = InheritanceUtil.existsMutualSubclass(operandClass, checkClass, isOnTheFly()); if (hasMutualSubclass == ThreeState.NO) { registerError(checkTypeElement, checkClass.isInterface(), operandClassName); } else if (hasMutualSubclass == ThreeState.UNSURE) { registerPossibleProblem(checkTypeElement); } }