CompareInfo (PsiMethodCallExpression call) { if (call == null) return null; PsiElement nameElement = call.getMethodExpression().getReferenceNameElement(); if (nameElement == null) return null; String name = nameElement.getText(); if (!"compareTo".equals(name)) return null; PsiExpression[] args = call.getArgumentList().getExpressions(); if (args.length != 1) return null; PsiExpression arg = args[0]; PsiExpression qualifier = call.getMethodExpression().getQualifierExpression(); if (qualifier == null) return null; PsiClassType boxedType = getBoxedType(call); if (boxedType == null) return null; PsiPrimitiveType primitiveType = PsiPrimitiveType.getUnboxedType(boxedType); if (!isTypeConvertible(primitiveType, call)) return null; PsiExpression left = extractPrimitive(boxedType, primitiveType, qualifier); if (left == null) return null; PsiExpression right = extractPrimitive(boxedType, primitiveType, arg); if (right == null) return null; return new CompareInfo(call, call, left, right, boxedType, false); }