boolean (MethodSignature o1, MethodSignature o2) { if (o1.equals(o2)) { final PsiMethod method1 = ((MethodSignatureBackedByPsiMethod)o1).getMethod(); final PsiType returnType1 = method1.getReturnType(); final PsiMethod method2 = ((MethodSignatureBackedByPsiMethod)o2).getMethod(); final PsiType returnType2 = method2.getReturnType(); if (method1.hasModifierProperty(PsiModifier.STATIC) || method2.hasModifierProperty(PsiModifier.STATIC)) { return true; } if (MethodSignatureUtil.isReturnTypeSubstitutable(o1, o2, returnType1, returnType2)) { return true; } final PsiClass containingClass1 = method1.getContainingClass(); final PsiClass containingClass2 = method2.getContainingClass(); if (containingClass1 != null && containingClass2 != null) { return containingClass1.isAnnotationType() || containingClass2.isAnnotationType(); } } return false; }