Examples of CatchTree


Examples of com.sun.source.tree.CatchTree

      });

  @Override
  public Description matchTry(TryTree tree, VisitorState state) {
    if (tryTreeMatches(tree, state)) {
      CatchTree firstCatch = tree.getCatches().get(0);
      VariableTree catchParameter = firstCatch.getParameter();
      return describeMatch(firstCatch,
          SuggestedFix.replace(catchParameter, "Exception " + catchParameter.getName()));
    } else {
      return Description.NO_MATCH;
    }
View Full Code Here

Examples of com.sun.source.tree.CatchTree

    if (catches.size() != 1) {
      // TODO(user): this could be supported - only the last catch would need
      // to be checked - it would either be Throwable or Error.
      return false;
    }
    CatchTree catchTree = catches.get(0);
    VariableTree catchType = catchTree.getParameter();
    if (!javaLangThrowable.matches(catchType, state)) {
      // TODO(user): Error could be supported
      return false;
    }

    // Verify that the catch block is empty or contains only comments.
    List<? extends StatementTree> catchStatements = catchTree.getBlock().getStatements();
    for (StatementTree catchStatement : catchStatements) {
      // Comments are not a part of the AST. Therefore, we should either get
      // an empty list of statements (regardless of the number of comments),
      // or a list of empty statements.
      if (!Matchers.<Tree>kindIs(EMPTY_STATEMENT).matches(catchStatement, state)) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.