String (int paramCount, PsiMethodReferenceExpression methodRef) { PsiElement element = methodRef.resolve(); if (element instanceof PsiMethod method) { String name = method.getName(); PsiClass aClass = method.getContainingClass(); if (aClass != null) { String className = aClass.getQualifiedName(); if("java.util.Objects".equals(className) && paramCount == 1) { if (name.equals("nonNull")) { return "{0}!=null"; } if (name.equals("isNull")) { return "{0}==null"; } } if (paramCount == 2 && name.equals("sum") && (CommonClassNames.JAVA_LANG_INTEGER.equals(className) || CommonClassNames.JAVA_LANG_LONG.equals(className) || CommonClassNames.JAVA_LANG_DOUBLE.equals(className))) { return "{0}+{1}"; } if(CommonClassNames.JAVA_LANG_CLASS.equals(className) && paramCount == 1) { PsiExpression qualifier = methodRef.getQualifierExpression(); if(qualifier instanceof PsiClassObjectAccessExpression) { PsiTypeElement type = ((PsiClassObjectAccessExpression)qualifier).getOperand(); if(name.equals("isInstance")) { return "{0} instanceof "+type.getText(); } if(name.equals("cast")) { return "("+type.getText()+"){0}"; } } } } } return null; }