Package lombok.ast

Examples of lombok.ast.ArrayCreation


      if (node.getType() == null) {
        set(node, init == null ? new ArrayInitializer() : init);
        return;
      }
     
      ArrayCreation crea = new ArrayCreation();
      JCTree type = node.getType();
      java.util.List<Position> inits = Lists.newArrayList();
      while (type instanceof JCArrayTypeTree) {
        inits.add(getPosition(type));
        type = ((JCArrayTypeTree) type).getType();
      }
     
      crea.rawComponentTypeReference(toTree(type, FlagKey.TYPE_REFERENCE));
      if (node.getDimensions() != null) for (JCExpression dim : node.getDimensions()) {
        crea.astDimensions().addToEnd(setPos(dim, new ArrayDimension().rawDimension(toTree(dim))));
      }
     
      if (init != null) crea.astDimensions().addToEnd(new ArrayDimension());
     
      // new boolean [][][] {} in javac has one less dimension for some reason.
      for (Position i : inits) {
        ArrayDimension dim = new ArrayDimension();
        dim.setPosition(i);
        crea.astDimensions().addToEnd(dim);
      }
     
      crea.astInitializer(init);
      set(node, crea);
    }
View Full Code Here


    if (arrayOpen != null) d.setPosition(new Position(arrayOpen.getStartIndex(), currentPos()));
    return d;
  }
 
  public Node createArrayCreationExpression(Node type, List<Node> dimensions, Node initializer) {
    ArrayCreation ac = new ArrayCreation().rawComponentTypeReference(type).rawInitializer(initializer);
    if (dimensions != null) for (Node d : dimensions) {
      if (d != null) ac.rawDimensions().addToEnd(d);
    }
   
    return posify(ac);
  }
View Full Code Here

TOP

Related Classes of lombok.ast.ArrayCreation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.