boolean (@NotNull GrNewExpression newExp1, @NotNull GrNewExpression newExp2) { if (newExp1.getArrayCount() == newExp2.getArrayCount() && newExp1.getArrayCount() != 0) { GrCodeReferenceElement referenceElement1 = newExp1.getReferenceElement(); GrCodeReferenceElement referenceElement2 = newExp2.getReferenceElement(); if (referenceElement1 == null || referenceElement2 == null) { return referenceElement1 == referenceElement2; } if (referenceElement1.resolve() != referenceElement2.resolve()) { return false; } GrArrayDeclaration arrayDeclaration1 = newExp1.getArrayDeclaration(); GrArrayDeclaration arrayDeclaration2 = newExp2.getArrayDeclaration(); if (arrayDeclaration1 == null || arrayDeclaration2 == null) { return arrayDeclaration1 == arrayDeclaration2; } return arrayDeclarationsAreEquivalent(arrayDeclaration1, arrayDeclaration2); } else { final PsiMethod constructor1 = newExp1.resolveMethod(); final PsiMethod constructor2 = newExp2.resolveMethod(); if (constructor1 == null || constructor2 == null || !constructor1.equals(constructor2)) { return false; } return argumentListsAreEquivalent(newExp1.getArgumentList(), newExp2.getArgumentList()); } }