ProblemDescriptor (PsiMethodCallExpression call) { PsiExpression equalTo = PsiUtil.skipParenthesizedExprDown(call.getArgumentList().getExpressions()[0]); if (equalTo == null) return null; //case: "foo".equals(s.toLowerCase()) if (equalTo instanceof PsiMethodCallExpression equalsToCallExpression && isChangeCaseCall(equalsToCallExpression, call.getMethodExpression().getQualifierExpression())) { PsiElement anchor = equalsToCallExpression.getMethodExpression().getReferenceNameElement(); if (anchor == null) { return null; } return createChangeCaseProblem(equalsToCallExpression, anchor, RemoveRedundantChangeCaseFix.PlaceCaseEqualType.RIGHT); } PsiMethodCallExpression qualifierCall = MethodCallUtils.getQualifierMethodCall(call); if (qualifierCall == null) return null; PsiExpression receiver = qualifierCall.getMethodExpression().getQualifierExpression(); if (receiver == null) return null; PsiElement anchor = qualifierCall.getMethodExpression().getReferenceNameElement(); if (anchor == null) { return null; } if (isChangeCaseCall(qualifierCall, equalTo)) { //case: text1.toLowerCase().equals("test2") return createChangeCaseProblem(qualifierCall, anchor, RemoveRedundantChangeCaseFix.PlaceCaseEqualType.LEFT); } //case: text1.toLowerCase().equals(text2.toLowerCase()) if (equalTo instanceof PsiMethodCallExpression secondCall && isEqualChangeCaseCall(qualifierCall, secondCall)) { return createChangeCaseProblem(secondCall, anchor, RemoveRedundantChangeCaseFix.PlaceCaseEqualType.BOTH); } return null; }