boolean (GrClosureSignatureUtil.ArgInfo<PsiElement> arg, GrClosureParameter param, PsiSubstitutor substitutor, Project project, GroovyPsiElement context) { final PsiType type = param.getType(); //todo find out if param is array in case of it has declared type if (type instanceof PsiEllipsisType) { for (PsiElement element : arg.args) { LOG.assertTrue(element instanceof GrExpression); ((GrExpression)element).accept(myExpressionGenerator); myBuilder.append(", "); } if (!arg.args.isEmpty()) { myBuilder.delete(myBuilder.length() - 2, myBuilder.length()); return true; } else { return false; } } else if (type instanceof PsiArrayType) { myBuilder.append("new "); if (arg.args.isEmpty()) { TypeWriter.writeType(myBuilder, ((PsiArrayType)type).getComponentType(), context); myBuilder.append("[0]"); } else { TypeWriter.writeTypeForNew(myBuilder, type, context); myBuilder.append("{"); for (PsiElement element : arg.args) { LOG.assertTrue(element instanceof GrExpression); ((GrExpression)element).accept(myExpressionGenerator); myBuilder.append(", "); } if (!arg.args.isEmpty()) myBuilder.delete(myBuilder.length() - 2, myBuilder.length()); //if (arg.args.size() > 0) myBuilder.removeFromTheEnd(2); myBuilder.append('}'); } } else { final GrExpression listOrMap = GroovyRefactoringUtil.generateArgFromMultiArg(substitutor, arg.args, type, project); LOG.assertTrue(listOrMap instanceof GrListOrMap); listOrMap.accept(myExpressionGenerator); } return true; }