private static boolean instanceofExpressionsAreEquivalent( GrInstanceOfExpression expression1, GrInstanceOfExpression expression2) { final GrExpression operand1 = expression1.getOperand(); final GrExpression operand2 = expression2.getOperand(); if (!expressionsAreEquivalent(operand1, operand2)) { return false; } final PsiType type1 = expression1.getTypeElement().getType(); final PsiType type2 = expression2.getTypeElement().getType(); return typesAreEquivalent(type1, type2); }
@Override public void visitInstanceofExpression(GrInstanceOfExpression expression) { final GrExpression operand = expression.getOperand(); final GrTypeElement typeElement = expression.getTypeElement(); if (typeElement == null) return; if (myExpression == operand) { final PsiType type = typeElement.getType(); myResult = new TypeConstraint[] {new SupertypeConstraint(type, type)}; } }