ReplaceWithObjectsEqualsFix (@NotNull PsiMethodCallExpression call, @NotNull PsiReferenceExpression methodExpression) { if (!"equals".equals(methodExpression.getReferenceName()) || call.getArgumentList().getExpressionCount() != 1 || !PsiUtil.getLanguageLevel(call).isAtLeast(LanguageLevel.JDK_1_7)) { return null; } PsiExpression qualifier = methodExpression.getQualifierExpression(); PsiExpression noParens = PsiUtil.skipParenthesizedExprDown(qualifier); if (noParens == null) return null; PsiMethod method = call.resolveMethod(); if (method != null && method.getParameterList().getParametersCount() == 1 && Objects.requireNonNull(method.getParameterList().getParameter(0)).getType().equalsToText(CommonClassNames.JAVA_LANG_OBJECT)) { return new ReplaceWithObjectsEqualsFix(qualifier.getText(), noParens.getText()); } return null; }