void (@NotNull PsiClass superClass, @NotNull PsiClass derivedClass) { if (!ourReportedInconsistencies.add(derivedClass.getQualifiedName() + "/" + superClass.getQualifiedName()) && !ApplicationManager.getApplication().isUnitTestMode()) { return; } StringBuilder msg = new StringBuilder("superClassSubstitutor requested when derived doesn't extend super:\n" + "Super: " + classInfo(superClass) + "Derived: " + classInfo(derivedClass) +"isInheritor: via util=" + InheritanceUtil.isInheritorOrSelf(derivedClass, superClass, true) + ", directly=" + derivedClass.isInheritor(superClass, true) + "\n" + "Super in derived's scope: " + PsiSearchScopeUtil.isInScope(derivedClass.getResolveScope(), superClass) + "\n" + (InheritanceUtil.processSupers(derivedClass, false, s -> s != superClass) ? "" : "Plain derived's supers contain Super\n") +"Hierarchy:\n"); new ScopedClassHierarchy(derivedClass, derivedClass.getResolveScope()) { @Override void visitType(@NotNull PsiClassType type, Map<PsiClass, PsiClassType.ClassResolveResult> map) { PsiClass eachClass = type.resolve(); msg.append(" each: "); msg.append(eachClass == null ? "unresolved " + type : classInfo(eachClass)); super.visitType(type, map); } }.visitType(JavaPsiFacade.getElementFactory(derivedClass.getProject()).createType(derivedClass, PsiSubstitutor.EMPTY), new HashMap<>()); LOG.error(msg.toString()); }