PsiElement (PsiMethodCallExpression call) { PsiExpression value = myValuePointer.getElement(); if (value == null) return null; PsiMethodCallExpression qualifierCall = getQualifierMethodCall(call); if (qualifierCall == null) return null; PsiExpressionList qualifierArgs = qualifierCall.getArgumentList(); CommentTracker ct = new CommentTracker(); PsiReferenceParameterList typeParameters = qualifierCall.getMethodExpression().getParameterList(); String typeParametersText = typeParameters == null ? "" : ct.text(typeParameters); String factory; if (PsiUtil.isLanguageLevel9OrHigher(call) && MethodCallUtils.isVarArgCall(qualifierCall) && ContainerUtil .and(qualifierArgs.getExpressions(), e -> NullabilityUtil.getExpressionNullability(e, true) == Nullability.NOT_NULL)) { factory = JAVA_UTIL_LIST + "." + typeParametersText + "of"; } else { factory = JAVA_UTIL_ARRAYS + "." + typeParametersText + "asList"; } PsiElement result = ct.replaceAndRestoreComments(call, factory + ct.text(qualifierArgs) + ".contains(" + ct.text(value) + ")"); return JavaCodeStyleManager.getInstance(result.getProject()).shortenClassReferences(result); }