boolean (PsiMethod method1, PsiMethod method2) { if (!method1.getName().equals(method2.getName()) || !typesAreEquivalent(method1.getReturnType(), method2.getReturnType())) { return false; } PsiParameter[] parameters1 = method1.getParameterList().getParameters(); PsiParameter[] parameters2 = method2.getParameterList().getParameters(); if (parameters1.length != parameters2.length) { return false; } for (int j = 0; j < parameters1.length; j++) { if (!variableSignatureMatch(parameters1[j], parameters2[j])) { return false; } } PsiClassType[] thrownTypes1 = method1.getThrowsList().getReferencedTypes(); PsiClassType[] thrownTypes2 = method2.getThrowsList().getReferencedTypes(); if (thrownTypes1.length != thrownTypes2.length) { return false; } for (int i = 0; i < thrownTypes1.length; i++) { if (!typesAreEquivalent(thrownTypes1[i], thrownTypes2[i])) { return false; } } markDeclarationsAsEquivalent(method1, method2); return true; }