boolean (@NotNull TypeConstraints.ClassDef other) { if (!(other instanceof JavaClassDef)) return false; PsiClass otherClass = ((JavaClassDef)other).myClass; if (myClass.isInterface() || otherClass.isInterface()) { if (otherClass.hasModifierProperty(PsiModifier.SEALED)) return canConvertSealedTo(otherClass, myClass); if (myClass.hasModifierProperty(PsiModifier.SEALED)) return canConvertSealedTo(myClass, otherClass); } if (myClass.isInterface() && otherClass.isInterface()) return true; if (myClass.isInterface() && !otherClass.hasModifierProperty(PsiModifier.FINAL)) return true; if (otherClass.isInterface() && !myClass.hasModifierProperty(PsiModifier.FINAL)) return true; PsiManager manager = myClass.getManager(); return manager.areElementsEquivalent(myClass, otherClass) || otherClass.isInheritor(myClass, true) || myClass.isInheritor(otherClass, true); }