Search in sources :

Example 1 with ImportTreeImpl

use of org.sonar.java.model.JavaTree.ImportTreeImpl in project sonar-java by SonarSource.

the class TreeFactory method newImportDeclaration.

public ImportTreeImpl newImportDeclaration(InternalSyntaxToken importToken, Optional<InternalSyntaxToken> staticToken, ExpressionTree qualifiedIdentifier, Optional<Tuple<InternalSyntaxToken, InternalSyntaxToken>> dotStar, InternalSyntaxToken semicolonToken) {
    ExpressionTree target = qualifiedIdentifier;
    if (dotStar.isPresent()) {
        IdentifierTreeImpl identifier = new IdentifierTreeImpl(dotStar.get().second());
        InternalSyntaxToken dotToken = dotStar.get().first();
        target = new MemberSelectExpressionTreeImpl(qualifiedIdentifier, dotToken, identifier);
    }
    InternalSyntaxToken staticKeyword = staticToken.orNull();
    return new ImportTreeImpl(importToken, staticKeyword, target, semicolonToken);
}
Also used : IdentifierTreeImpl(org.sonar.java.model.expression.IdentifierTreeImpl) ImportTreeImpl(org.sonar.java.model.JavaTree.ImportTreeImpl) ExpressionTree(org.sonar.plugins.java.api.tree.ExpressionTree) InternalSyntaxToken(org.sonar.java.model.InternalSyntaxToken) MemberSelectExpressionTreeImpl(org.sonar.java.model.expression.MemberSelectExpressionTreeImpl)

Aggregations

InternalSyntaxToken (org.sonar.java.model.InternalSyntaxToken)1 ImportTreeImpl (org.sonar.java.model.JavaTree.ImportTreeImpl)1 IdentifierTreeImpl (org.sonar.java.model.expression.IdentifierTreeImpl)1 MemberSelectExpressionTreeImpl (org.sonar.java.model.expression.MemberSelectExpressionTreeImpl)1 ExpressionTree (org.sonar.plugins.java.api.tree.ExpressionTree)1