use of org.sonar.java.model.JavaTree.ArrayTypeTreeImpl in project sonar-java by SonarSource.
the class TreeFactory method newVariableDeclaratorId.
public VariableTreeImpl newVariableDeclaratorId(InternalSyntaxToken identifierToken, Optional<List<Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>>>> dims) {
IdentifierTreeImpl identifier = new IdentifierTreeImpl(identifierToken);
ArrayTypeTreeImpl nestedDimensions = newArrayTypeTreeWithAnnotations(dims);
return new VariableTreeImpl(identifier, nestedDimensions);
}
use of org.sonar.java.model.JavaTree.ArrayTypeTreeImpl in project sonar-java by SonarSource.
the class TreeFactory method completeVariableDeclarator.
public VariableTreeImpl completeVariableDeclarator(InternalSyntaxToken identifierToken, Optional<List<Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>>>> dimensions, Optional<VariableTreeImpl> partial) {
IdentifierTreeImpl identifier = new IdentifierTreeImpl(identifierToken);
ArrayTypeTreeImpl nestedDimensions = newArrayTypeTreeWithAnnotations(dimensions);
if (partial.isPresent()) {
return partial.get().completeIdentifierAndDims(identifier, nestedDimensions);
} else {
return new VariableTreeImpl(identifier, nestedDimensions);
}
}
use of org.sonar.java.model.JavaTree.ArrayTypeTreeImpl in project sonar-java by SonarSource.
the class TreeFactory method newDotClassSelector.
public ExpressionTree newDotClassSelector(Optional<List<Tuple<InternalSyntaxToken, InternalSyntaxToken>>> dimensions, InternalSyntaxToken dotToken, InternalSyntaxToken classToken) {
IdentifierTreeImpl identifier = new IdentifierTreeImpl(classToken);
ArrayTypeTreeImpl nestedDimensions = newArrayTypeTree(dimensions);
return new MemberSelectExpressionTreeImpl(nestedDimensions, dotToken, identifier);
}
use of org.sonar.java.model.JavaTree.ArrayTypeTreeImpl in project sonar-java by SonarSource.
the class TreeFactory method newArrayTypeTreeWithAnnotations.
private static ArrayTypeTreeImpl newArrayTypeTreeWithAnnotations(TypeTree type, Tuple<Optional<List<AnnotationTreeImpl>>, Tuple<InternalSyntaxToken, InternalSyntaxToken>> dim) {
List<AnnotationTreeImpl> annotations = dim.first().or(ImmutableList.<AnnotationTreeImpl>of());
InternalSyntaxToken openBracketToken = dim.second().first();
InternalSyntaxToken closeBracketToken = dim.second().second();
return new ArrayTypeTreeImpl(type, annotations, openBracketToken, closeBracketToken);
}
use of org.sonar.java.model.JavaTree.ArrayTypeTreeImpl in project sonar-java by SonarSource.
the class TreeFactory method basicClassExpression.
public ExpressionTree basicClassExpression(PrimitiveTypeTreeImpl basicType, Optional<List<Tuple<InternalSyntaxToken, InternalSyntaxToken>>> dimensions, InternalSyntaxToken dotToken, InternalSyntaxToken classToken) {
// 15.8.2. Class Literals
// int.class
// int[].class
IdentifierTreeImpl classIdentifier = new IdentifierTreeImpl(classToken);
ArrayTypeTreeImpl nestedDimensions = newArrayTypeTree(dimensions);
TypeTree typeTree = applyDim(basicType, nestedDimensions);
return new MemberSelectExpressionTreeImpl((ExpressionTree) typeTree, dotToken, classIdentifier);
}
Aggregations