use of org.sonar.plugins.java.api.tree.TypeTree in project sonar-java by SonarSource.
the class TreeFactory method newExpression.
public ExpressionTree newExpression(InternalSyntaxToken newToken, Optional<List<AnnotationTreeImpl>> annotations, ExpressionTree partial) {
TypeTree typeTree;
if (partial.is(Tree.Kind.NEW_CLASS)) {
NewClassTreeImpl newClassTree = (NewClassTreeImpl) partial;
newClassTree.completeWithNewKeyword(newToken);
typeTree = newClassTree.identifier();
} else {
NewArrayTreeImpl newArrayTree = (NewArrayTreeImpl) partial;
newArrayTree.completeWithNewKeyword(newToken);
typeTree = newArrayTree.type();
}
completeTypeTreeWithAnnotations(typeTree, annotations);
return partial;
}
Aggregations