gpt4 book ai didi

org.sonar.plugins.java.api.tree.WhileStatementTree类的使用及代码示例

转载 作者:知者 更新时间:2024-03-21 15:15:05 27 4
gpt4 key购买 nike

本文整理了Java中org.sonar.plugins.java.api.tree.WhileStatementTree类的一些代码示例,展示了WhileStatementTree类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WhileStatementTree类的具体详情如下:
包路径:org.sonar.plugins.java.api.tree.WhileStatementTree
类名称:WhileStatementTree

WhileStatementTree介绍

[英]'while' statement. JLS 14.12

while ( 
#condition())  
#statement

[中]“while”声明。JLS 14.12

while ( 
#condition())  
#statement

代码示例

代码示例来源:origin: SonarSource/sonar-java

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 scan(tree.condition());
 scan(tree.statement());
}

代码示例来源:origin: SonarSource/sonar-java

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 // do not scan the condition
 addLines(tree.whileKeyword(), tree.closeParenToken());
 addLineOfCloseBrace(tree.whileKeyword(), tree.statement());
 scan(tree.statement());
}

代码示例来源:origin: SonarSource/sonar-java

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 blame.add(tree.firstToken());
 super.visitWhileStatement(tree);
}

代码示例来源:origin: SonarSource/sonar-java

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 checkBlock(tree.closeParenToken(), tree.statement());
 super.visitWhileStatement(tree);
}

代码示例来源:origin: SonarSource/sonar-java

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 scan(tree.statement());
}

代码示例来源:origin: SonarSource/sonar-java

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 if (LiteralUtils.isTrue(tree.condition())) {
  checkLoopWithAlwaysTrueCondition(context, tree);
 }
}

代码示例来源:origin: SonarSource/sonar-java

@Override
public void visitNode(Tree tree) {
 switch (tree.kind()) {
  case WHILE_STATEMENT:
   WhileStatementTree whileStatementTree = (WhileStatementTree) tree;
   checkStatement(whileStatementTree.whileKeyword(), whileStatementTree.statement());
   break;
  case DO_STATEMENT:
   DoWhileStatementTree doWhileStatementTree = (DoWhileStatementTree) tree;
   checkStatement(doWhileStatementTree.doKeyword(), doWhileStatementTree.statement());
   break;
  case FOR_STATEMENT:
   ForStatementTree forStatementTree = (ForStatementTree) tree;
   checkStatement(forStatementTree.forKeyword(), forStatementTree.statement());
   break;
  case FOR_EACH_STATEMENT:
   ForEachStatement forEachStatement = (ForEachStatement) tree;
   checkStatement(forEachStatement.forKeyword(), forEachStatement.statement());
   break;
  case IF_STATEMENT:
   checkIfStatement((IfStatementTree) tree);
   break;
  default:
   break;
 }
}

代码示例来源:origin: SonarSource/sonar-java

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 SyntaxToken whileKeyword = tree.whileKeyword();
 checkNesting(whileKeyword);
 nestingLevel.push(whileKeyword);
 super.visitWhileStatement(tree);
 nestingLevel.pop();
}

代码示例来源:origin: org.sonarsource.java/java-checks

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 scan(tree.statement());
}

代码示例来源:origin: org.sonarsource.java/java-frontend

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 if (LiteralUtils.isTrue(tree.condition())) {
  checkLoopWithAlwaysTrueCondition(context, tree);
 }
}

代码示例来源:origin: org.sonarsource.java/java-checks

@Override
public void visitNode(Tree tree) {
 switch (tree.kind()) {
  case WHILE_STATEMENT:
   WhileStatementTree whileStatementTree = (WhileStatementTree) tree;
   checkStatement(whileStatementTree.whileKeyword(), whileStatementTree.statement());
   break;
  case DO_STATEMENT:
   DoWhileStatementTree doWhileStatementTree = (DoWhileStatementTree) tree;
   checkStatement(doWhileStatementTree.doKeyword(), doWhileStatementTree.statement());
   break;
  case FOR_STATEMENT:
   ForStatementTree forStatementTree = (ForStatementTree) tree;
   checkStatement(forStatementTree.forKeyword(), forStatementTree.statement());
   break;
  case FOR_EACH_STATEMENT:
   ForEachStatement forEachStatement = (ForEachStatement) tree;
   checkStatement(forEachStatement.forKeyword(), forEachStatement.statement());
   break;
  case IF_STATEMENT:
   checkIfStatement((IfStatementTree) tree);
   break;
  default:
   break;
 }
}

代码示例来源:origin: org.sonarsource.java/java-checks

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 checkBlock(tree.closeParenToken(), tree.statement());
 super.visitWhileStatement(tree);
}

代码示例来源:origin: org.sonarsource.java/java-checks

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 SyntaxToken whileKeyword = tree.whileKeyword();
 checkNesting(whileKeyword);
 nestingLevel.push(whileKeyword);
 super.visitWhileStatement(tree);
 nestingLevel.pop();
}

代码示例来源:origin: org.codehaus.sonar-plugins.java/java-squid

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 scan(tree.condition());
 scan(tree.statement());
}

代码示例来源:origin: org.sonarsource.java/java-checks

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 // do not scan the condition
 addLines(tree.whileKeyword(), tree.closeParenToken());
 addLineOfCloseBrace(tree.whileKeyword(), tree.statement());
 scan(tree.statement());
}

代码示例来源:origin: SonarSource/sonar-java

private static Tree loopStatement(Tree loopTree) {
 if (loopTree.is(Tree.Kind.FOR_STATEMENT)) {
  return ((ForStatementTree) loopTree).statement();
 } else if (loopTree.is(Tree.Kind.DO_STATEMENT)) {
  return ((DoWhileStatementTree) loopTree).statement();
 } else if (loopTree.is(Tree.Kind.WHILE_STATEMENT)) {
  return ((WhileStatementTree) loopTree).statement();
 } else if (loopTree.is(Tree.Kind.FOR_EACH_STATEMENT)) {
  return ((ForEachStatement) loopTree).statement();
 }
 return null;
}

代码示例来源:origin: SonarSource/sonar-java

/**
 * While loops are sometimes used to get only the first element of an enumeration/collection, using code similar to:
 * <code>
 * while(myIterator.hasNext()) {
 *   // ...
 *   return myIterator.next(); // unconditional jump
 * }
 * </code>
 */
private static boolean isWhileNextElementLoop(Tree loopTree) {
 if (loopTree.is(Tree.Kind.WHILE_STATEMENT)) {
  ExpressionTree condition = ExpressionUtils.skipParentheses(((WhileStatementTree) loopTree).condition());
  return condition.is(Tree.Kind.METHOD_INVOCATION) && NEXT_ELEMENT.anyMatch((MethodInvocationTree) condition);
 }
 return false;
}

代码示例来源:origin: DarLiner/vjtools

@Override
public void visitNode(Tree tree) {
  switch (tree.kind()) {
  case WHILE_STATEMENT:
    WhileStatementTree whileStatementTree = (WhileStatementTree) tree;
    checkStatement(whileStatementTree.whileKeyword(), whileStatementTree.statement());
    break;
  case DO_STATEMENT:
    DoWhileStatementTree doWhileStatementTree = (DoWhileStatementTree) tree;
    checkStatement(doWhileStatementTree.doKeyword(), doWhileStatementTree.statement());
    break;
  case FOR_STATEMENT:
    ForStatementTree forStatementTree = (ForStatementTree) tree;
    checkStatement(forStatementTree.forKeyword(), forStatementTree.statement());
    break;
  case FOR_EACH_STATEMENT:
    ForEachStatement forEachStatement = (ForEachStatement) tree;
    checkStatement(forEachStatement.forKeyword(), forEachStatement.statement());
    break;
  case IF_STATEMENT:
    checkIfStatement((IfStatementTree) tree);
    break;
  default:
    break;
  }
}

代码示例来源:origin: SonarSource/sonar-java

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 increaseComplexityByNesting(tree.whileKeyword());
 nesting++;
 super.visitWhileStatement(tree);
 nesting--;
}

代码示例来源:origin: org.sonarsource.java/java-frontend

@Override
public void visitWhileStatement(WhileStatementTree tree) {
 blame.add(tree.firstToken());
 super.visitWhileStatement(tree);
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com