boolean (PsiMethod method1, PsiMethod method2) { final PsiType type1 = method1.getReturnType(); if (type1 == null) { return false; } final PsiType type2 = method2.getReturnType(); if (type1 instanceof PsiClassType && type2 instanceof PsiClassType) { final PsiClass superClass = method2.getContainingClass(); final PsiClass aClass = method1.getContainingClass(); if (aClass == null || superClass == null) return false; final PsiSubstitutor substitutor = TypeConversionUtil.getSuperClassSubstitutor(superClass, aClass, PsiSubstitutor.EMPTY); return type1.equals(substitutor.substitute(type2)) && !(((PsiClassType)type1).resolve() instanceof PsiTypeParameter); } else { return type1.equals(type2); } }