void (@NotNull Project project, @NotNull PsiMethodCallExpression call) { PsiExpression[] args = call.getArgumentList().getExpressions(); if (args.length != 1) return; PsiElement parent = PsiUtil.skipParenthesizedExprUp(call.getParent()); CommentTracker ct = new CommentTracker(); if (parent instanceof PsiLocalVariable) { PsiTypeElement typeElement = ((PsiLocalVariable)parent).getTypeElement(); if (!typeElement.isInferredType()) { PsiType varType = ((PsiLocalVariable)parent).getType(); PsiType elementType = PsiUtil.substituteTypeParameter(varType, CommonClassNames.JAVA_LANG_ITERABLE, 0, false); if (elementType == null) { PsiType type = args[0].getType(); if (!(type instanceof PsiArrayType)) return; elementType = ((PsiArrayType)type).getComponentType(); } if (elementType instanceof PsiWildcardType) { elementType = ((PsiWildcardType)elementType).getExtendsBound(); } typeElement.replace(JavaPsiFacade.getElementFactory(project).createTypeElement(elementType.createArrayType())); } } ct.replaceAndRestoreComments(call, args[0]); }