use of com.sun.source.tree.NewArrayTree in project checker-framework by typetools.
the class CFGTranslationPhaseOne method visitNewArray.
@Override
public Node visitNewArray(NewArrayTree tree, Void p) {
// see JLS 15.10
ArrayType type = (ArrayType) TreeUtils.typeOf(tree);
TypeMirror elemType = type.getComponentType();
List<? extends ExpressionTree> dimensions = tree.getDimensions();
List<? extends ExpressionTree> initializers = tree.getInitializers();
assert dimensions != null;
List<Node> dimensionNodes = CollectionsPlume.mapList(dim -> unaryNumericPromotion(scan(dim, p)), dimensions);
List<Node> initializerNodes;
if (initializers == null) {
initializerNodes = Collections.emptyList();
} else {
initializerNodes = CollectionsPlume.mapList(init -> assignConvert(scan(init, p), elemType), initializers);
}
Node node = new ArrayCreationNode(tree, type, dimensionNodes, initializerNodes);
extendWithNodeWithExceptions(node, newArrayExceptionTypes);
return node;
}
Aggregations