void (@NotNull PsiMethodCallExpression expression) { super.visitMethodCallExpression(expression); final PsiReferenceExpression methodExpression = expression.getMethodExpression(); final @NonNls String methodName = methodExpression.getReferenceName(); if (!"asList".equals(methodName)) { return; } final PsiExpressionList argumentList = expression.getArgumentList(); final PsiExpression[] arguments = argumentList.getExpressions(); if (arguments.length > 1) return; boolean suggestListOf = PsiUtil.isLanguageLevel9OrHigher(expression); boolean empty = false; if (arguments.length == 0) { empty = true; } else { final PsiExpression argument = arguments[0]; if (!MethodCallUtils.isVarArgCall(expression)) { if (!ConstructionUtils.isEmptyArrayInitializer(argument)) { return; } empty = true; } if (suggestListOf && NullabilityUtil.getExpressionNullability(argument, true) != Nullability.NOT_NULL) { // Avoid suggesting List.of with potentially nullable argument suggestListOf = false; } } final PsiMethod method = expression.resolveMethod(); if (method == null) { return; } final PsiClass containingClass = method.getContainingClass(); if (containingClass == null) { return; } final String className = containingClass.getQualifiedName(); if (!"java.util.Arrays".equals(className)) { return; } registerMethodCallError(expression, empty, suggestListOf); }