Java Code Examples for com.sun.tools.javac.tree.JCTree.JCNewArray#getInitializers()
The following examples show how to use
com.sun.tools.javac.tree.JCTree.JCNewArray#getInitializers() .
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: CompilationUnitBuilder.java From j2cl with Apache License 2.0 | 6 votes |
private NewArray convertNewArray(JCNewArray expression) { ArrayTypeDescriptor typeDescriptor = environment.createTypeDescriptor(expression.type, ArrayTypeDescriptor.class); List<Expression> dimensionExpressions = convertExpressions(expression.getDimensions()); // If some dimensions are not initialized then make that explicit. while (dimensionExpressions.size() < typeDescriptor.getDimensions()) { dimensionExpressions.add(NullLiteral.get()); } ArrayLiteral arrayLiteral = expression.getInitializers() == null ? null : new ArrayLiteral(typeDescriptor, convertExpressions(expression.getInitializers())); return NewArray.newBuilder() .setTypeDescriptor(typeDescriptor) .setDimensionExpressions(dimensionExpressions) .setArrayLiteral(arrayLiteral) .build(); }
Example 2
Source File: ArrayCreationTree.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
public Void visitNewArray(NewArrayTree node, Void ignore) { // the Tree API hasn't been updated to expose annotations yet JCNewArray newArray = (JCNewArray)node; int totalLength = node.getDimensions().size() + arrayLength(node.getType()) + ((newArray.getInitializers() != null) ? 1 : 0); testAnnotations(newArray.annotations, totalLength); int count = 0; for (List<? extends AnnotationTree> annos : newArray.dimAnnotations) { testAnnotations(annos, totalLength - count); count++; } return super.visitNewArray(node, ignore); }
Example 3
Source File: ArrayCreationTree.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public Void visitNewArray(NewArrayTree node, Void ignore) { // the Tree API hasn't been updated to expose annotations yet JCNewArray newArray = (JCNewArray)node; int totalLength = node.getDimensions().size() + arrayLength(node.getType()) + ((newArray.getInitializers() != null) ? 1 : 0); testAnnotations(newArray.annotations, totalLength); int count = 0; for (List<? extends AnnotationTree> annos : newArray.dimAnnotations) { testAnnotations(annos, totalLength - count); count++; } return super.visitNewArray(node, ignore); }
Example 4
Source File: ArrayCreationTree.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public Void visitNewArray(NewArrayTree node, Void ignore) { // the Tree API hasn't been updated to expose annotations yet JCNewArray newArray = (JCNewArray)node; int totalLength = node.getDimensions().size() + arrayLength(node.getType()) + ((newArray.getInitializers() != null) ? 1 : 0); testAnnotations(newArray.annotations, totalLength); int count = 0; for (List<? extends AnnotationTree> annos : newArray.dimAnnotations) { testAnnotations(annos, totalLength - count); count++; } return super.visitNewArray(node, ignore); }
Example 5
Source File: ArrayCreationTree.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public Void visitNewArray(NewArrayTree node, Void ignore) { // the Tree API hasn't been updated to expose annotations yet JCNewArray newArray = (JCNewArray)node; int totalLength = node.getDimensions().size() + arrayLength(node.getType()) + ((newArray.getInitializers() != null) ? 1 : 0); testAnnotations(newArray.annotations, totalLength); int count = 0; for (List<? extends AnnotationTree> annos : newArray.dimAnnotations) { testAnnotations(annos, totalLength - count); count++; } return super.visitNewArray(node, ignore); }
Example 6
Source File: ArrayCreationTree.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
public Void visitNewArray(NewArrayTree node, Void ignore) { // the Tree API hasn't been updated to expose annotations yet JCNewArray newArray = (JCNewArray)node; int totalLength = node.getDimensions().size() + arrayLength(node.getType()) + ((newArray.getInitializers() != null) ? 1 : 0); testAnnotations(newArray.annotations, totalLength); int count = 0; for (List<? extends AnnotationTree> annos : newArray.dimAnnotations) { testAnnotations(annos, totalLength - count); count++; } return super.visitNewArray(node, ignore); }
Example 7
Source File: ArrayCreationTree.java From hottub with GNU General Public License v2.0 | 5 votes |
public Void visitNewArray(NewArrayTree node, Void ignore) { // the Tree API hasn't been updated to expose annotations yet JCNewArray newArray = (JCNewArray)node; int totalLength = node.getDimensions().size() + arrayLength(node.getType()) + ((newArray.getInitializers() != null) ? 1 : 0); testAnnotations(newArray.annotations, totalLength); int count = 0; for (List<? extends AnnotationTree> annos : newArray.dimAnnotations) { testAnnotations(annos, totalLength - count); count++; } return super.visitNewArray(node, ignore); }
Example 8
Source File: ArrayCreationTree.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public Void visitNewArray(NewArrayTree node, Void ignore) { // the Tree API hasn't been updated to expose annotations yet JCNewArray newArray = (JCNewArray)node; int totalLength = node.getDimensions().size() + arrayLength(node.getType()) + ((newArray.getInitializers() != null) ? 1 : 0); testAnnotations(newArray.annotations, totalLength); int count = 0; for (List<? extends AnnotationTree> annos : newArray.dimAnnotations) { testAnnotations(annos, totalLength - count); count++; } return super.visitNewArray(node, ignore); }
Example 9
Source File: ArrayCreationTree.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public Void visitNewArray(NewArrayTree node, Void ignore) { // the Tree API hasn't been updated to expose annotations yet JCNewArray newArray = (JCNewArray)node; int totalLength = node.getDimensions().size() + arrayLength(node.getType()) + ((newArray.getInitializers() != null) ? 1 : 0); testAnnotations(newArray.annotations, totalLength); int count = 0; for (List<? extends AnnotationTree> annos : newArray.dimAnnotations) { testAnnotations(annos, totalLength - count); count++; } return super.visitNewArray(node, ignore); }