PrimitiveComparison (PsiMethodCallExpression methodCall) { PsiMethod method = methodCall.resolveMethod(); if (method != null && method.getName().equals("compare")) { PsiClass containingClass = method.getContainingClass(); if (containingClass != null) { String className = containingClass.getQualifiedName(); if (className != null) { PsiExpression[] args = methodCall.getArgumentList().getExpressions(); if (args.length != 2) return null; PsiExpression keyExtractor = args[0]; String methodName = getComparingMethodName(className); if(methodName == null) return null; return new PrimitiveComparison(keyExtractor, methodName); } } } return null; }