Package com.sun.source.tree

Examples of com.sun.source.tree.AssignmentTree


    CompilationUnitTree unitTree = path.getCompilationUnit();
    LineMap lineMap = unitTree.getLineMap();
    SourcePositions positions = treeUtils.getSourcePositions();

    AnnotationTree annotationTree = (AnnotationTree) path.getLeaf();
    AssignmentTree assignTree =
        (AssignmentTree) annotationTree.getArguments().get(0);
    ExpressionTree exprTree = assignTree.getExpression();

    ArrayList<Long> lines = new ArrayList<Long>();
    if (exprTree.getKind() == Kind.STRING_LITERAL) {
      long pos = positions.getStartPosition(unitTree, exprTree);
      lines.add(lineMap.getLineNumber(pos));
View Full Code Here


  @Override
  public boolean matches(AnnotationTree annotationTree, VisitorState state) {
    for (ExpressionTree argumentTree : annotationTree.getArguments()) {
      if (argumentTree.getKind() == Tree.Kind.ASSIGNMENT) {
        AssignmentTree assignmentTree = (AssignmentTree) argumentTree;
        if (assignmentTree.getVariable().toString().equals(element)) {
          ExpressionTree expressionTree = assignmentTree.getExpression();
          while (expressionTree instanceof ParenthesizedTree) {
            expressionTree = ((ParenthesizedTree) expressionTree).getExpression();
          }

          if (expressionTree instanceof NewArrayTree) {
View Full Code Here

  abstract protected void processSuppressWarningsValues(List<String> values);

  protected final Fix getSuggestedFix(AnnotationTree annotationTree) {
    List<String> values = new ArrayList<>();
    for (ExpressionTree argumentTree : annotationTree.getArguments()) {
      AssignmentTree assignmentTree = (AssignmentTree) argumentTree;
      if (assignmentTree.getVariable().toString().equals("value")) {
        ExpressionTree expressionTree = assignmentTree.getExpression();
        switch (expressionTree.getKind()) {
          case STRING_LITERAL:
            values.add(((String) ((JCTree.JCLiteral) expressionTree).value));
            break;
          case NEW_ARRAY:
View Full Code Here

    List<NameValue<JS>> props = new ArrayList<NameValue<JS>>();
    if (initBlock != null) {
      for (StatementTree stmt : initBlock.getStatements()) {
        // check the right type of statements x=y is done in NewClassObjectInitCheck
        AssignmentTree assign = (AssignmentTree) ((ExpressionStatementTree) stmt).getExpression();
        props.add(NameValue.of(getPropertyName(assign.getVariable()), visitor.scan(assign.getExpression(), tw.getContext())));
      }
    }
    return tw.getContext().js().object(props);
  }
View Full Code Here

TOP

Related Classes of com.sun.source.tree.AssignmentTree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.