MergeSuperType (@NotNull PsiClass aClass, @NotNull MethodSignatureBackedByPsiMethod hierarchicalMethodSignature, @NotNull MethodSignatureBackedByPsiMethod superSignatureHierarchical) { PsiMethod superMethod = superSignatureHierarchical.getMethod(); PsiClass superClass = superMethod.getContainingClass(); PsiMethod method = hierarchicalMethodSignature.getMethod(); PsiClass containingClass = method.getContainingClass(); if (!superMethod.isConstructor() && !aClass.equals(superClass) && MethodSignatureUtil.isSubsignature(superSignatureHierarchical, hierarchicalMethodSignature) && superClass != null) { if (superClass.isInterface() || CommonClassNames.JAVA_LANG_OBJECT.equals(superClass.getQualifiedName())) { if (superMethod.hasModifierProperty(PsiModifier.DEFAULT) && //static method can't be from interface (see com.intellij.psi.impl.PsiSuperMethodImplUtil.canBeStoreInMap), // so it is inheritable, then according to //jls 8, 8.4.8.2. it is a compile-time error method.hasModifierProperty(PsiModifier.STATIC) && !InheritanceUtil.isInheritorOrSelf(containingClass, superClass, true)) { //return method as base, it will be processed by // com.intellij.codeInsight.daemon.impl.analysis.HighlightMethodUtil.checkOverrideEquivalentInheritedMethods //it requires that static method must be a base return MergeSuperType.FORCE_MERGE; } if (superMethod.hasModifierProperty(PsiModifier.DEFAULT) || method.hasModifierProperty(PsiModifier.DEFAULT)) { boolean isSuper = superMethod.equals(method) || !InheritanceUtil.isInheritorOrSelf(superClass, containingClass, true); return isSuper ? MergeSuperType.MERGE_SUPER : MergeSuperType.NOT_MERGE_SUPER; } return MergeSuperType.MERGE_SUPER; } if (containingClass != null) { if (containingClass.isInterface()) { return MergeSuperType.NOT_MERGE_SUPER; } if (!aClass.isInterface() && !InheritanceUtil.isInheritorOrSelf(superClass, containingClass, true)) { return MergeSuperType.MERGE_SUPER; } } } return MergeSuperType.NOT_MERGE_SUPER; }