当前位置: 首页>>代码示例>>Java>>正文


Java EmptyStatementTree类代码示例

本文整理汇总了Java中com.sun.source.tree.EmptyStatementTree的典型用法代码示例。如果您正苦于以下问题:Java EmptyStatementTree类的具体用法?Java EmptyStatementTree怎么用?Java EmptyStatementTree使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EmptyStatementTree类属于com.sun.source.tree包,在下文中一共展示了EmptyStatementTree类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: visitIf

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@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;
}
 
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:17,代码来源:ReformatTreeVisitor.java

示例2: visitEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@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;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:TreeDuplicator.java

示例3: visitEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@Override
public Boolean visitEmptyStatement(EmptyStatementTree node, TreePath p) {
    if (p == null) {
        super.visitEmptyStatement(node, p);
        return false;
    }
    return node.getKind() == p.getLeaf().getKind();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CopyFinder.java

示例4: visitEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:TreeNode.java

示例5: visitEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@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);
}
 
开发者ID:google,项目名称:error-prone,代码行数:15,代码来源:ErrorProneScanner.java

示例6: matchEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
/**
 * 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()));
  }
}
 
开发者ID:google,项目名称:error-prone,代码行数:40,代码来源:EmptyIfStatement.java

示例7: matchEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
/**
 * 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);
  }
}
 
开发者ID:diy1,项目名称:error-prone-aspirator,代码行数:43,代码来源:EmptyIfStatement.java

示例8: visitEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@Override
public Void visitEmptyStatement(EmptyStatementTree expected, Tree actual) {
  if (!checkTypeAndCast(expected, actual).isPresent()) {
    addTypeMismatch(expected, actual);
    return null;
  }
  return null;
}
 
开发者ID:google,项目名称:compile-testing,代码行数:9,代码来源:TreeDiffer.java

示例9: visitEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
public Boolean visitEmptyStatement(EmptyStatementTree node, ConstructorData p) {
    super.visitEmptyStatement(node, p);
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:Flow.java

示例10: visitEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@Override
public List<? extends TypeMirror> visitEmptyStatement(EmptyStatementTree node, Object p) {
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:ExpectedTypeResolver.java

示例11: visitEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@Override
public Mirror visitEmptyStatement(EmptyStatementTree arg0, EvaluationContext evaluationContext) {
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:EvaluatorVisitor.java

示例12: visitEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@Override
public Void visitEmptyStatement(EmptyStatementTree node, Void unused) {
    sync(node);
    dropEmptyDeclarations();
    return null;
}
 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:7,代码来源:JavaInputAstVisitor.java

示例13: visitEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@Override
public R visitEmptyStatement(EmptyStatementTree est, P p) {
    return null;
}
 
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:5,代码来源:ApexTreeVisitorAdapter.java

示例14: visitEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@Override
public List<T> visitEmptyStatement(EmptyStatementTree node, T p) {
    return checkForCriteria(node);
}
 
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:5,代码来源:TreeFinder.java

示例15: createEmptyStatement

import com.sun.source.tree.EmptyStatementTree; //导入依赖的package包/类
@Override
public EmptyStatementTree createEmptyStatement() {
    return new EmptyStatementTreeImpl();
}
 
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:5,代码来源:ApexTreeFactory.java


注:本文中的com.sun.source.tree.EmptyStatementTree类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。