boolean (@NotNull PsiNewExpression pattern, @NotNull PsiNewExpression candidate) { final PsiType type1 = pattern.getType(); final PsiType type2 = candidate.getType(); if (type1 == null || type2 == null) return false; final PsiMethod constructor1 = pattern.resolveConstructor(); final PsiMethod constructor2 = candidate.resolveConstructor(); if (constructor1 != null && constructor2 != null) { if (!pattern.getManager().areElementsEquivalent(constructor1, constructor2)) return false; } else { if (!canTypesBeEquivalent(type1, type2)) return false; } return true; }