com.sun.source.tree.NewArrayTree Java Examples

The following examples show how to use com.sun.source.tree.NewArrayTree. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaInputAstVisitor.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
static int rowLength(List<? extends ExpressionTree> row) {
    int size = 0;
    for (ExpressionTree tree : row) {
        if (tree.getKind() != NEW_ARRAY) {
            size++;
            continue;
        }
        NewArrayTree array = (NewArrayTree) tree;
        if (array.getInitializers() == null) {
            size++;
            continue;
        }
        size += rowLength(array.getInitializers());
    }
    return size;
}
 
Example #2
Source File: SuspiciousToArray.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void rewriteNewArrayTree(WorkingCopy copy, TreeMaker mk, TreePath natPath, TypeMirror compType) {
    NewArrayTree nat = (NewArrayTree)natPath.getLeaf();
    TypeMirror existing = copy.getTrees().getTypeMirror(natPath);
    int existingDim = numberOfDimensions(existing);
    int newDim = numberOfDimensions(compType);
    
    if (existingDim == newDim + 1 /* newDim is counted from component type, lacks the enclosing array */) {
        // simple, number of dimensions does not change
        copy.rewrite(nat.getType(), mk.Type(compType));
        return;
    }
    List<ExpressionTree> l = new ArrayList<ExpressionTree>(nat.getDimensions().subList(
            0, Math.min(newDim + 1, nat.getDimensions().size())));
    Tree replacement = mk.NewArray(mk.Type(compType), l, null);
    GeneratorUtilities.get(copy).copyComments(nat, replacement, true);
    GeneratorUtilities.get(copy).copyComments(nat, replacement, false);
    
    copy.rewrite(nat, replacement);
}
 
Example #3
Source File: TreeConverter.java    From j2objc with Apache License 2.0 6 votes vote down vote up
private TreeNode convertNewArray(NewArrayTree node, TreePath parent) {
  TreePath path = getTreePath(parent, node);
  ArrayCreation newNode = new ArrayCreation();
  List<Expression> dimensions = new ArrayList<>();
  for (ExpressionTree dimension : node.getDimensions()) {
    dimensions.add((Expression) convert(dimension, path));
  }
  javax.lang.model.type.ArrayType type = (javax.lang.model.type.ArrayType) getTypeMirror(path);
  if (node.getInitializers() != null) {
    ArrayInitializer initializers = new ArrayInitializer(type);
    for (ExpressionTree initializer : node.getInitializers()) {
      initializers.addExpression((Expression) convert(initializer, path));
    }
    newNode.setInitializer(initializers);
  }
  return newNode
      .setType((ArrayType) new ArrayType(type).setPosition(getPosition(node)))
      .setDimensions(dimensions);
}
 
Example #4
Source File: JavaInputAstVisitor.java    From google-java-format with Apache License 2.0 6 votes vote down vote up
static int rowLength(List<? extends ExpressionTree> row) {
  int size = 0;
  for (ExpressionTree tree : row) {
    if (tree.getKind() != NEW_ARRAY) {
      size++;
      continue;
    }
    NewArrayTree array = (NewArrayTree) tree;
    if (array.getInitializers() == null) {
      size++;
      continue;
    }
    size += rowLength(array.getInitializers());
  }
  return size;
}
 
Example #5
Source File: ConstantNameHint.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private static boolean checkZeroSizeArray(CompilationInfo info, TreePath val) {
    if (val.getLeaf().getKind() != Tree.Kind.VARIABLE) {
        return false;
    }
    VariableTree vt = (VariableTree)val.getLeaf();
    ExpressionTree xpr = vt.getInitializer();
    if (xpr == null) {
        return false;
    }
    if (xpr.getKind() == Tree.Kind.NEW_ARRAY) {
        NewArrayTree nat = (NewArrayTree)xpr;
        List<? extends ExpressionTree> dims = nat.getDimensions();
        if (dims != null && !dims.isEmpty()) {
            Object size = ArithmeticUtilities.compute(info, 
                    new TreePath(
                        new TreePath(val, xpr),
                        dims.get(dims.size() -1)), 
                    true);
            return ArithmeticUtilities.isRealValue(size) && Integer.valueOf(0).equals(size);
        } else {
            return nat.getInitializers() != null && nat.getInitializers().isEmpty();
        }
    }
    return false;
}
 
Example #6
Source File: Utilities.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static List<AnnotationTree> findArrayValue(AnnotationTree at, String name) {
    ExpressionTree fixesArray = findValue(at, name);
    List<AnnotationTree> fixes = new LinkedList<AnnotationTree>();

    if (fixesArray != null && fixesArray.getKind() == Kind.NEW_ARRAY) {
        NewArrayTree trees = (NewArrayTree) fixesArray;

        for (ExpressionTree fix : trees.getInitializers()) {
            if (fix.getKind() == Kind.ANNOTATION) {
                fixes.add((AnnotationTree) fix);
            }
        }
    }

    if (fixesArray != null && fixesArray.getKind() == Kind.ANNOTATION) {
        fixes.add((AnnotationTree) fixesArray);
    }
    
    return fixes;
}
 
Example #7
Source File: JavaInputAstVisitor.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
static int rowLength(List<? extends ExpressionTree> row) {
    int size = 0;
    for (ExpressionTree tree : row) {
        if (tree.getKind() != NEW_ARRAY) {
            size++;
            continue;
        }
        NewArrayTree array = (NewArrayTree) tree;
        if (array.getInitializers() == null) {
            size++;
            continue;
        }
        size += rowLength(array.getInitializers());
    }
    return size;
}
 
Example #8
Source File: CreateElementUtilities.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static List<? extends TypeMirror> computeNewArray(Set<ElementKind> types, CompilationInfo info, TreePath parent, Tree error, int offset) {
    NewArrayTree nat = (NewArrayTree) parent.getLeaf();
    
    if (nat.getType() == error) {
        types.add(ElementKind.CLASS);
        types.add(ElementKind.ENUM);
        types.add(ElementKind.INTERFACE);
        
        return null;
    }
    
    for (Tree dimension : nat.getDimensions()) {
        if (dimension == error) {
            types.add(ElementKind.PARAMETER);
            types.add(ElementKind.LOCAL_VARIABLE);
            types.add(ElementKind.FIELD);
            
            return Collections.singletonList(info.getTypes().getPrimitiveType(TypeKind.INT));
        }
    }
    
    for (Tree init : nat.getInitializers()) {
        if (init == error) {
            TypeMirror whole = info.getTrees().getTypeMirror(parent);
            
            if (whole == null || whole.getKind() != TypeKind.ARRAY)
                return null;
            
            types.add(ElementKind.PARAMETER);
            types.add(ElementKind.LOCAL_VARIABLE);
            types.add(ElementKind.FIELD);
            
            return Collections.singletonList(((ArrayType) whole).getComponentType());
        }
    }
    
    return null;
}
 
Example #9
Source File: JavaInputAstVisitor.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
@Override
    public Void visitNewArray(NewArrayTree node, Void unused) {
        if (node.getType() != null) {
            builder.open(plusFour);
            token("new");
            builder.space();

            TypeWithDims extractedDims = DimensionHelpers.extractDims(node.getType(), SortedDims.YES);
            Tree base = extractedDims.node;

            Deque<ExpressionTree> dimExpressions = new ArrayDeque<>(node.getDimensions());

            Deque<List<AnnotationTree>> annotations = new ArrayDeque<>();
            // TODO: 22-Jul-17 missing method java8
//            annotations.add(ImmutableList.copyOf(node.getAnnotations()));
//            annotations.addAll((List<List<AnnotationTree>>) node.getDimAnnotations());
            annotations.addAll(extractedDims.dims);

            scan(base, null);
            builder.open(ZERO);
            maybeAddDims(dimExpressions, annotations);
            builder.close();
            builder.close();
        }
        if (node.getInitializers() != null) {
            if (node.getType() != null) {
                builder.space();
            }
            visitArrayInitializer(node.getInitializers());
        }
        return null;
    }
 
Example #10
Source File: ExpectedTypeResolver.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public List<? extends TypeMirror> visitNewArray(NewArrayTree node, Object p) {
    if (node.getDimensions() == null) {
        return null;
    }
    if (theExpression == null && node.getDimensions().size() == 1) {
        initExpression(node.getDimensions().get(0));
    } else if (!node.getDimensions().contains(theExpression.getLeaf())) {
        return null;
    }
    return Collections.singletonList(info.getTypes().getPrimitiveType(TypeKind.INT));
}
 
Example #11
Source File: Move.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private ExpressionTree transformInitializer(ExpressionTree initializer, Tree type, TreeMaker make) {
    if(initializer.getKind() == Tree.Kind.NEW_ARRAY) {
        NewArrayTree nat = (NewArrayTree) initializer;
        if(nat.getType() == null) {
            if(type.getKind() == Tree.Kind.ARRAY_TYPE) {
                ArrayTypeTree arrayTypeTree = (ArrayTypeTree) type;
                type = arrayTypeTree.getType();
            }
            return make.NewArray(type, nat.getDimensions(), nat.getInitializers());
        }
    }
    return initializer;
}
 
Example #12
Source File: ComputeImports.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitNewArray(NewArrayTree node, Map<String, Object> p) {
    scan(node.getType(), p, true);
    scan(node.getDimensions(), new HashMap<String, Object>());
    scan(node.getInitializers(), new HashMap<String, Object>());
    return null;
}
 
Example #13
Source File: ExpressionScanner.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public List<Tree> visitNewArray(NewArrayTree node, ExpressionScanner.ExpressionsInfo p) {
    List<Tree> result = scan(node.getType(), p);
    result = reduce(result, scan(node.getDimensions(), p));
    result = reduce(result, scan(node.getInitializers(), p));
    return result;
}
 
Example #14
Source File: JavaInputAstVisitor.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
@Override
    public Void visitNewArray(NewArrayTree node, Void unused) {
        if (node.getType() != null) {
            builder.open(plusFour);
            token("new");
            builder.space();

            TypeWithDims extractedDims = DimensionHelpers.extractDims(node.getType(), SortedDims.YES);
            Tree base = extractedDims.node;

            Deque<ExpressionTree> dimExpressions = new ArrayDeque<>(node.getDimensions());

            Deque<List<AnnotationTree>> annotations = new ArrayDeque<>();
            // TODO: 22-Jul-17 missing method java8
//            annotations.add(ImmutableList.copyOf(node.getAnnotations()));
//            annotations.addAll((List<List<AnnotationTree>>) node.getDimAnnotations());
            annotations.addAll(extractedDims.dims);

            scan(base, null);
            builder.open(ZERO);
            maybeAddDims(dimExpressions, annotations);
            builder.close();
            builder.close();
        }
        if (node.getInitializers() != null) {
            if (node.getType() != null) {
                builder.space();
            }
            visitArrayInitializer(node.getInitializers());
        }
        return null;
    }
 
Example #15
Source File: TreeFinder.java    From annotation-tools with MIT License 5 votes vote down vote up
private void addNewType(TreePath path, NewInsertion neu,
    NewArrayTree newArray) {
  DeclaredType baseType = neu.getBaseType();
  if (baseType.getName().isEmpty()) {
    List<String> annotations = neu.getType().getAnnotations();
    Type newType = Insertions.TypeTree.javacTypeToType(
        ((JCTree.JCNewArray) newArray).type);
    for (String ann : annotations) {
      newType.addAnnotation(ann);
    }
    neu.setType(newType);
  }
  Insertion.decorateType(neu.getInnerTypeInsertions(), neu.getType(),
      neu.getCriteria().getASTPath());
}
 
Example #16
Source File: NewScanner.java    From annotation-tools with MIT License 5 votes vote down vote up
@Override
public Void visitNewArray(NewArrayTree node, Void p) {
    if (!done) {
        index++;
    }
    if (tree == node) {
        done = true;
    }
    return super.visitNewArray(node, p);
}
 
Example #17
Source File: JavaInputAstVisitor.java    From google-java-format with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitNewArray(NewArrayTree node, Void unused) {
  if (node.getType() != null) {
    builder.open(plusFour);
    token("new");
    builder.space();

    TypeWithDims extractedDims = DimensionHelpers.extractDims(node.getType(), SortedDims.YES);
    Tree base = extractedDims.node;

    Deque<ExpressionTree> dimExpressions = new ArrayDeque<>(node.getDimensions());

    Deque<List<? extends AnnotationTree>> annotations = new ArrayDeque<>();
    annotations.add(ImmutableList.copyOf(node.getAnnotations()));
    annotations.addAll(node.getDimAnnotations());
    annotations.addAll(extractedDims.dims);

    scan(base, null);
    builder.open(ZERO);
    maybeAddDims(dimExpressions, annotations);
    builder.close();
    builder.close();
  }
  if (node.getInitializers() != null) {
    if (node.getType() != null) {
      builder.space();
    }
    visitArrayInitializer(node.getInitializers());
  }
  return null;
}
 
Example #18
Source File: JavaInputAstVisitor.java    From google-java-format with Apache License 2.0 5 votes vote down vote up
private static boolean isArrayValue(ExpressionTree argument) {
  if (!(argument instanceof AssignmentTree)) {
    return false;
  }
  ExpressionTree expression = ((AssignmentTree) argument).getExpression();
  return expression instanceof NewArrayTree && ((NewArrayTree) expression).getType() == null;
}
 
Example #19
Source File: UNewArray.java    From Refaster with Apache License 2.0 5 votes vote down vote up
@Override
@Nullable
public Unifier visitNewArray(NewArrayTree newArray, @Nullable Unifier unifier) {
  unifier = Unifier.unifyNullable(unifier, getType(), newArray.getType());
  unifier = Unifier.unifyList(unifier, getDimensions(), newArray.getDimensions());

  boolean hasRepeated = getInitializers() != null 
      && Iterables.any(getInitializers(), Predicates.instanceOf(URepeated.class));
  return Unifier.unifyList(unifier, getInitializers(), newArray.getInitializers(), hasRepeated);
}
 
Example #20
Source File: TreeDiffer.java    From compile-testing with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitNewArray(NewArrayTree expected, Tree actual) {
  Optional<NewArrayTree> other = checkTypeAndCast(expected, actual);
  if (!other.isPresent()) {
    addTypeMismatch(expected, actual);
    return null;
  }

  scan(expected.getType(), other.get().getType());
  parallelScan(expected.getDimensions(), other.get().getDimensions());
  parallelScan(expected.getInitializers(), other.get().getInitializers());
  return null;
}
 
Example #21
Source File: TreeDuplicator.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Tree visitNewArray(NewArrayTree tree, Void p) {
    NewArrayTree n = make.NewArray(tree.getType(), tree.getDimensions(), tree.getInitializers());
    model.setType(n, model.getType(tree));
    comments.copyComments(tree, n);
    model.setPos(n, model.getPos(tree));
    return n;
}
 
Example #22
Source File: SuspiciousToArray.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
protected void performRewrite(TransformationContext ctx) throws Exception {
    WorkingCopy wc = ctx.getWorkingCopy();
    TreePath path = ctx.getPath();
    TypeMirror compType = ctype.resolve(wc);
    if (compType == null) {
        return;
    }
    TreeMaker mk = wc.getTreeMaker();
    Tree l = path.getLeaf();
    if (l.getKind() == Tree.Kind.NEW_ARRAY) {
        NewArrayTree nat = (NewArrayTree)l;
        // if there are some initializers, we should probably rewrite the whole expression.
        if (nat.getInitializers() == null) {
            rewriteNewArrayTree(wc, mk, path, compType);
            return;
        }
    }
    // replace the entire tree
    TreePath colRef = null;
    if (colReference != null) {
        colRef = colReference.resolve(wc);
        if (colRef == null) {
            return;
        }
    }
    GeneratorUtilities gu = GeneratorUtilities.get(wc);
    Tree lc = gu.importComments(l, wc.getCompilationUnit());
    Tree newArrayTree = mk.NewArray(mk.Type(compType), Collections.<ExpressionTree>singletonList(
            mk.MethodInvocation(Collections.<ExpressionTree>emptyList(), 
                colRef == null ? mk.Identifier("size") :
                mk.MemberSelect((ExpressionTree)colRef.getLeaf(), "size"), // NOI18N
                Collections.<ExpressionTree>emptyList())),
            null);
    gu.copyComments(lc, newArrayTree, true);
    gu.copyComments(lc, newArrayTree, false);
    wc.rewrite(lc, newArrayTree);
}
 
Example #23
Source File: CopyFinder.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Boolean visitNewArray(NewArrayTree node, TreePath p) {
    if (p == null)
        return super.visitNewArray(node, p);

    NewArrayTree t = (NewArrayTree) p.getLeaf();

    if (!checkLists(node.getDimensions(), t.getDimensions(), p))
        return false;

    if (!checkLists(node.getInitializers(), t.getInitializers(), p))
        return false;

    return scan(node.getType(), t.getType(), p);
}
 
Example #24
Source File: Unbalanced.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@TriggerPattern(value="$mods$ $type[] $name = $init$;")
public static ErrorDescription after(HintContext ctx) {
    VariableElement var = testElement(ctx);

    if (var == null) return null;

    Tree parent = ctx.getPath().getParentPath().getLeaf();

    if (parent.getKind() == Kind.ENHANCED_FOR_LOOP
        && ((EnhancedForLoopTree) parent).getVariable() == ctx.getPath().getLeaf()) {
        return null;
    }
    
    TreePath init = ctx.getVariables().get("$init$");

    if (init != null) {
        boolean asWrite = true;
        
        if (init.getLeaf().getKind() == Kind.NEW_ARRAY) {
            NewArrayTree nat = (NewArrayTree) init.getLeaf();

            if (nat.getInitializers() == null || nat.getInitializers().isEmpty()) {
                asWrite = false;
            }
        }
        
        if (asWrite) {
            record(ctx.getInfo(), var, State.WRITE);
        }
    }

    return produceWarning(ctx, "ERR_UnbalancedArray");
}
 
Example #25
Source File: TreeNode.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Void visitNewArray(NewArrayTree tree, List<Node> d) {
    List<Node> below = new ArrayList<Node>();
    
    addCorrespondingElement(below);
    addCorrespondingType(below);
    addCorrespondingComments(below);
    
    super.visitNewArray(tree, below);
    
    d.add(new TreeNode(info, getCurrentPath(), below));
    return null;
}
 
Example #26
Source File: ArraysTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void test120768() throws Exception {
    testFile = new File(getWorkDir(), "Test.java");
    TestUtilities.copyStringToFile(testFile, 
        "package hierbas.del.litoral;\n" +
        "\n" +
        "public class Test {\n" +
        "    byte[] test = new byte[10000];\n" +
        "}\n"
        );
    String golden =
        "package hierbas.del.litoral;\n" +
        "\n" +
        "public class Test {\n" +
        "    byte[] test = new byte[WHAT_A_F];\n" +
        "}\n";
    JavaSource src = getJavaSource(testFile);
    Task<WorkingCopy> task = new Task<WorkingCopy>() {

        public void run(WorkingCopy workingCopy) throws IOException {
            workingCopy.toPhase(Phase.RESOLVED);
            CompilationUnitTree cut = workingCopy.getCompilationUnit();
            TreeMaker make = workingCopy.getTreeMaker();
            ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
            VariableTree var = (VariableTree) clazz.getMembers().get(1);
            NewArrayTree nat = (NewArrayTree) var.getInitializer();
            workingCopy.rewrite(nat.getDimensions().get(0), make.Identifier("WHAT_A_F"));
        }

    };
    src.runModificationTask(task).commit();
    String res = TestUtilities.copyFileToString(testFile);
    //System.err.println(res);
    assertEquals(golden, res);
}
 
Example #27
Source File: ArraysTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public void test162485a() throws Exception {
    testFile = new File(getWorkDir(), "Test.java");
    TestUtilities.copyStringToFile(testFile, 
        "package hierbas.del.litoral;\n" +
        "\n" +
        "public class Test {\n" +
        "    Object test = new int[2];\n" +
        "}\n"
        );
    String golden =
        "package hierbas.del.litoral;\n" +
        "\n" +
        "public class Test {\n" +
        "    Object test = {{1}};\n" +
        "}\n";
    JavaSource src = getJavaSource(testFile);
    Task<WorkingCopy> task = new Task<WorkingCopy>() {

        public void run(WorkingCopy workingCopy) throws IOException {
            workingCopy.toPhase(Phase.RESOLVED);
            CompilationUnitTree cut = workingCopy.getCompilationUnit();
            TreeMaker make = workingCopy.getTreeMaker();
            ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
            VariableTree var = (VariableTree) clazz.getMembers().get(1);
            NewArrayTree nat = (NewArrayTree) var.getInitializer();
            NewArrayTree dim2 = make.NewArray(null, Collections.<ExpressionTree>emptyList(), Collections.singletonList(make.Literal(Integer.valueOf(1))));
            NewArrayTree newTree = make.NewArray(null, Collections.<ExpressionTree>emptyList(), Collections.<ExpressionTree>singletonList(dim2));
            workingCopy.rewrite(nat, newTree);
        }

    };
    src.runModificationTask(task).commit();
    String res = TestUtilities.copyFileToString(testFile);
    //System.err.println(res);
    assertEquals(golden, res);
}
 
Example #28
Source File: ReplaceBufferByString.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Boolean visitNewArray(NewArrayTree node, Void p) {
    if (node.getInitializers() != null) {
        for (ExpressionTree et : node.getInitializers()) {
            if (scan(et, p) == Boolean.TRUE) {
                assignedToArray = true;
                break;
            }
        }
    }
    return false;
}
 
Example #29
Source File: CreateElementUtilities.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private static List<? extends TypeMirror> computeNewArray(Set<ElementKind> types, CompilationInfo info, TreePath parent, Tree error, int offset) {
    NewArrayTree nat = (NewArrayTree) parent.getLeaf();
    
    if (nat.getType() == error) {
        types.add(ElementKind.CLASS);
        types.add(ElementKind.ENUM);
        types.add(ElementKind.INTERFACE);
        
        return null;
    }
    
    for (Tree dimension : nat.getDimensions()) {
        if (dimension == error) {
            types.add(ElementKind.PARAMETER);
            types.add(ElementKind.LOCAL_VARIABLE);
            types.add(ElementKind.FIELD);
            
            return Collections.singletonList(info.getTypes().getPrimitiveType(TypeKind.INT));
        }
    }
    
    for (Tree init : nat.getInitializers()) {
        if (init == error) {
            TypeMirror whole = info.getTrees().getTypeMirror(parent);
            
            if (whole == null || whole.getKind() != TypeKind.ARRAY)
                return null;
            
            types.add(ElementKind.PARAMETER);
            types.add(ElementKind.LOCAL_VARIABLE);
            types.add(ElementKind.FIELD);
            
            return Collections.singletonList(((ArrayType) whole).getComponentType());
        }
    }
    
    return null;
}
 
Example #30
Source File: JavaFixUtilities.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public Number visitNewArray(NewArrayTree node, Void p) {
    List<? extends ExpressionTree> dimensions = (List<? extends ExpressionTree>) resolveMultiParameters(node.getDimensions());
    List<? extends ExpressionTree> initializers = (List<? extends ExpressionTree>) resolveMultiParameters(node.getInitializers());
    NewArrayTree nue = make.NewArray(node.getType(), dimensions, initializers);

    rewrite(node, nue);
    return super.visitNewArray(node, p);
}