Java 类com.sun.source.tree.EmptyStatementTree 实例源码

项目:oblivion-netbeans-plugin    文件:ReformatTreeVisitor.java   
@Override
public Void visitIf(IfTree ifTree, List<ReformatOption> optionsToReformat) {
    StatementTree thenStatement = ifTree.getThenStatement();
    if (thenStatement instanceof BlockTree) {
        addLeftBraceToList(optionsToReformat, ((BlockTree) thenStatement), PreferencesFormatOptions.BRACES_IN_OTHER_DECLARATION);
    }

    StatementTree elseStatement = ifTree.getElseStatement();
    if (elseStatement instanceof EmptyStatementTree && thenStatement instanceof CompoundTree) {
        addRightBraceToList(optionsToReformat, ((CompoundTree) thenStatement), PreferencesFormatOptions.AFTER_OTHER_DECLARATION);
    } else if (elseStatement instanceof BlockTree) {
        addLeftBraceToList(optionsToReformat, ((BlockTree) elseStatement), PreferencesFormatOptions.BRACES_IN_OTHER_DECLARATION);
    }

    return null;
}
项目:incubator-netbeans    文件:TreeDuplicator.java   
@Override
    public Tree visitEmptyStatement(EmptyStatementTree tree, Void p) {
        EmptyStatementTree n = make.EmptyStatement();
//        model.setType(n, model.getType(tree));
        comments.copyComments(tree, n);
        model.setPos(n, model.getPos(tree));
        return n;
    }
项目:incubator-netbeans    文件:CopyFinder.java   
@Override
public Boolean visitEmptyStatement(EmptyStatementTree node, TreePath p) {
    if (p == null) {
        super.visitEmptyStatement(node, p);
        return false;
    }
    return node.getKind() == p.getLeaf().getKind();
}
项目:incubator-netbeans    文件:TreeNode.java   
@Override
public Void visitEmptyStatement(EmptyStatementTree tree, List<Node> d) {
    List<Node> below = new ArrayList<Node>();

    addCorrespondingType(below);
    addCorrespondingComments(below);
    super.visitEmptyStatement(tree, below);

    d.add(new TreeNode(info, getCurrentPath(), below));
    return null;
}
项目:error-prone    文件:ErrorProneScanner.java   
@Override
public Void visitEmptyStatement(EmptyStatementTree tree, VisitorState visitorState) {
  VisitorState state = visitorState.withPath(getCurrentPath());
  for (EmptyStatementTreeMatcher matcher : emptyStatementMatchers) {
    if (!isSuppressed(matcher, state)) {
      try {
        reportMatch(matcher.matchEmptyStatement(tree, state), tree, state);
      } catch (Throwable t) {
        handleError(matcher, t);
      }
    }
  }
  return super.visitEmptyStatement(tree, state);
}
项目:error-prone    文件:EmptyIfStatement.java   
/**
 * Match empty statement if: - Parent statement is an if - The then part of the parent if is an
 * empty statement, and - The else part of the parent if does not exist
 */
@Override
public Description matchEmptyStatement(EmptyStatementTree tree, VisitorState state) {
  boolean matches = false;
  Tree parent = state.getPath().getParentPath().getLeaf();
  if (parent.getKind() == IF) {
    IfTree parentAsIf = (IfTree) parent;
    matches =
        (parentAsIf.getThenStatement() instanceof EmptyStatementTree)
            && (parentAsIf.getElseStatement() == null);
  }
  if (!matches) {
    return Description.NO_MATCH;
  }

  /*
   * We suggest different fixes depending on what follows the parent if statement.
   * If there is no statement following the if, then suggest deleting the whole
   * if statement. If the next statement is a block, then suggest deleting the
   * empty then part of the if.  If the next statement is not a block, then also
   * suggest deleting the empty then part of the if.
   */
  boolean nextStmtIsNull =
      parentNode(nextStatement(Matchers.<StatementTree>isSame(null))).matches(tree, state);

  assert (state.getPath().getParentPath().getLeaf().getKind() == IF);
  IfTree ifParent = (IfTree) state.getPath().getParentPath().getLeaf();
  if (nextStmtIsNull) {
    // No following statements. Delete whole if.
    return describeMatch(parent, SuggestedFix.delete(parent));
  } else {
    // There are more statements. Delete the empty then part of the if.
    return describeMatch(
        ifParent.getThenStatement(), SuggestedFix.delete(ifParent.getThenStatement()));
  }
}
项目:error-prone-aspirator    文件:EmptyIfStatement.java   
/**
 * Match empty statement if:
 * - Parent statement is an if
 * - The then part of the parent if is an empty statement, and
 * - The else part of the parent if does not exist
 */
@Override
public Description matchEmptyStatement(EmptyStatementTree tree, VisitorState state) {
  boolean matches = false;
  Tree parent = state.getPath().getParentPath().getLeaf();
  if (parent.getKind() == IF) {
    IfTree parentAsIf = (IfTree)parent;
    matches = (parentAsIf.getThenStatement() instanceof EmptyStatementTree) &&
        (parentAsIf.getElseStatement() == null);
  }
  if (!matches) {
    return Description.NO_MATCH;
  }

  /*
   * We suggest different fixes depending on what follows the parent if statement.
   * If there is no statement following the if, then suggest deleting the whole
   * if statement. If the next statement is a block, then suggest deleting the
   * empty then part of the if.  If the next statement is not a block, then also
   * suggest deleting the empty then part of the if.
   */
  boolean nextStmtIsNull = parentNode(nextStatement(Matchers.<StatementTree>isSame(null)))
      .matches(tree, state);

  assert(state.getPath().getParentPath().getLeaf().getKind() == IF);
  IfTree ifParent = (IfTree)state.getPath().getParentPath().getLeaf();
  SuggestedFix fix = new SuggestedFix();
  if (nextStmtIsNull) {
    // No following statements. Delete whole if.
    fix.delete(parent);
    return describeMatch(parent, fix);
  } else {
    // There are more statements. Delete the empty then part of the if.
    fix.delete(ifParent.getThenStatement());
    return describeMatch(ifParent.getThenStatement(), fix);
  }
}
项目:compile-testing    文件:TreeDiffer.java   
@Override
public Void visitEmptyStatement(EmptyStatementTree expected, Tree actual) {
  if (!checkTypeAndCast(expected, actual).isPresent()) {
    addTypeMismatch(expected, actual);
    return null;
  }
  return null;
}
项目:incubator-netbeans    文件:Flow.java   
public Boolean visitEmptyStatement(EmptyStatementTree node, ConstructorData p) {
    super.visitEmptyStatement(node, p);
    return null;
}
项目:incubator-netbeans    文件:ExpectedTypeResolver.java   
@Override
public List<? extends TypeMirror> visitEmptyStatement(EmptyStatementTree node, Object p) {
    return null;
}
项目:incubator-netbeans    文件:EvaluatorVisitor.java   
@Override
public Mirror visitEmptyStatement(EmptyStatementTree arg0, EvaluationContext evaluationContext) {
    return null;
}
项目:javaide    文件:JavaInputAstVisitor.java   
@Override
public Void visitEmptyStatement(EmptyStatementTree node, Void unused) {
    sync(node);
    dropEmptyDeclarations();
    return null;
}
项目:oblivion-netbeans-plugin    文件:ApexTreeVisitorAdapter.java   
@Override
public R visitEmptyStatement(EmptyStatementTree est, P p) {
    return null;
}
项目:oblivion-netbeans-plugin    文件:TreeFinder.java   
@Override
public List<T> visitEmptyStatement(EmptyStatementTree node, T p) {
    return checkForCriteria(node);
}
项目:oblivion-netbeans-plugin    文件:ApexTreeFactory.java   
@Override
public EmptyStatementTree createEmptyStatement() {
    return new EmptyStatementTreeImpl();
}
项目:adalid    文件:CodeAnalyzerTreeVisitor.java   
@Override
public Object visitEmptyStatement(EmptyStatementTree t, Trees p) {
    info("EmptyStatementTree" + CL + t.getKind() + SP + t);
    return super.visitEmptyStatement(t, p);
}
项目:refactor-faster    文件:UTemplater.java   
@Override
public USkip visitEmptyStatement(EmptyStatementTree tree, Void v) {
  return USkip.INSTANCE;
}
项目:refactor-faster    文件:USkip.java   
@Override
@Nullable
public Unifier visitEmptyStatement(EmptyStatementTree node, @Nullable Unifier unifier) {
  return unifier;
}
项目:error-prone    文件:Reachability.java   
@Override
public Boolean visitEmptyStatement(EmptyStatementTree tree, Void unused) {
  return true;
}
项目:error-prone    文件:UTemplater.java   
@Override
public USkip visitEmptyStatement(EmptyStatementTree tree, Void v) {
  return USkip.INSTANCE;
}
项目:error-prone    文件:USkip.java   
@Override
public Choice<Unifier> visitEmptyStatement(EmptyStatementTree node, Unifier unifier) {
  return Choice.of(unifier);
}
项目:error-prone-aspirator    文件:EmptyStatement.java   
@Override
public Description matchEmptyStatement(EmptyStatementTree emptyStatementTree, VisitorState state)
{
  return describeMatch(emptyStatementTree, new SuggestedFix().delete(emptyStatementTree));
}
项目:error-prone-aspirator    文件:CustomSuppressionTest.java   
@Override
public Description matchEmptyStatement(EmptyStatementTree tree, VisitorState state) {
  return describeMatch(tree, NO_FIX);
}
项目:checker-framework    文件:CFGBuilder.java   
@Override
public Node visitEmptyStatement(EmptyStatementTree tree, Void p) {
    return null;
}
项目:checker-framework    文件:PurityChecker.java   
@Override
public PurityResult visitEmptyStatement(EmptyStatementTree node,
        PurityResult p) {
    return p;
}
项目:Refaster    文件:UTemplater.java   
@Override
public USkip visitEmptyStatement(EmptyStatementTree tree, Void v) {
  return USkip.INSTANCE;
}
项目:Refaster    文件:USkip.java   
@Override
@Nullable
public Unifier visitEmptyStatement(EmptyStatementTree node, @Nullable Unifier unifier) {
  return unifier;
}
项目:bazel    文件:CFGBuilder.java   
@Override
public Node visitEmptyStatement(EmptyStatementTree tree, Void p) {
    return null;
}
项目:bazel    文件:PurityChecker.java   
@Override
public PurityResult visitEmptyStatement(EmptyStatementTree node, PurityResult p) {
    return p;
}
项目:oblivion-netbeans-plugin    文件:TreeFactory.java   
/**
 * Creates a tree node for an empty statement.
 * @return a new EmptyStatementTree object
 */
EmptyStatementTree createEmptyStatement();
项目:error-prone    文件:BugChecker.java   
Description matchEmptyStatement(EmptyStatementTree tree, VisitorState state);