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

项目:checker-framework    文件:CFGBuilder.java   
@Override
public Node visitBreak(BreakTree tree, Void p) {
    Name label = tree.getLabel();
    if (label == null) {
        assert breakTargetL != null : "no target for break statement";

        extendWithExtendedNode(new UnconditionalJump(breakTargetL));
    } else {
        assert breakLabels.containsKey(label);

        extendWithExtendedNode(new UnconditionalJump(
                breakLabels.get(label)));
    }

    return null;
}
项目:incubator-netbeans    文件:TreeDuplicator.java   
@Override
    public Tree visitBreak(BreakTree tree, Void p) {
        BreakTree n = make.Break(tree.getLabel());
//        model.setType(n, model.getType(tree));
        comments.copyComments(tree, n);
        model.setPos(n, model.getPos(tree));
        return n;
    }
项目:incubator-netbeans    文件:CopyFinder.java   
public Boolean visitBreak(BreakTree node, TreePath p) {
    if (p == null) {
        super.visitBreak(node, p);
        return false;
    }

    //XXX: check labels
    return true;
}
项目:incubator-netbeans    文件:LabelsTest.java   
public Void visitBreak(BreakTree node, Object p) {
    System.err.println("visitBreak: " + node.getLabel());
    super.visitBreak(node, p);
    BreakTree copy = make.setLabel(node, node.getLabel() + "0");
    this.copy.rewrite(node, copy);
    return null;
}
项目:incubator-netbeans    文件:BreakContinueTest.java   
public void testBreak158130() throws Exception {
    String test = "public class Test { void m(int p) { loop: while (true) { if (p == 0) { b|reak loop; } } } }";
    String golden = "public class Test { void m(int p) { loop: while (true) { if (p == 0) { break; } } } }";
    testHelper(test, golden, Kind.BREAK, new Delegate() {

        public void run(WorkingCopy copy, Tree tree) {
            BreakTree original = (BreakTree) tree;
            TreeMaker make = copy.getTreeMaker();
            BreakTree modified = make.Break(null);
            copy.rewrite(original, modified);
        }
    });
}
项目:incubator-netbeans    文件:BreakContinueTest.java   
public void testBreak166327() throws Exception {
    String test =
            "public class Test {" +
            "    public static void test(int y) {" +
            "        for (int u = y;;) {" +
            "            if (y == 0)" +
            "                br|eak;" +
            "            else" +
            "                y++;" +
            "        }" +
            "    }" +
            "}";
    String golden = 
            "public class Test {" +
            "    public static void test(int y) {" +
            "        for (int u = y;;) {" +
            "            if (y == 0)" +
            "                break;" +
            "            else" +
            "                y++;" +
            "        }" +
            "    }" +
            "}";

    testHelper(test, golden, Kind.BREAK, new Delegate() {

        public void run(WorkingCopy copy, Tree tree) {
            BreakTree oldBt = (BreakTree) tree;
            BreakTree newBt = copy.getTreeMaker().Break(null);
            copy.rewrite(oldBt, newBt);
        }

    });
}
项目:incubator-netbeans    文件:CyclomaticComplexityVisitor.java   
@Override
public Object visitBreak(BreakTree node, Object p) {
    // do not count the break, if it is nested in a switch 'case' statement.
    if (node.getLabel() != null || !switchCase) {
        complexity++;
    }
    return super.visitBreak(node, p);
}
项目:incubator-netbeans    文件:TreeNode.java   
@Override
public Void visitBreak(BreakTree tree, List<Node> d) {
    List<Node> below = new ArrayList<Node>();

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

    d.add(new TreeNode(info, getCurrentPath(), below));
    return null;
}
项目:incubator-netbeans    文件:TryCatchFinally.java   
@Override
public Void visitBreak(BreakTree node, Collection<TreePath> trees) {
    if (!analyzeThrows && !seenTrees.contains(info.getTreeUtilities().getBreakContinueTarget(getCurrentPath()))) {
        trees.add(getCurrentPath());
    }
    return null;
}
项目:incubator-netbeans    文件:ScanStatement.java   
@Override
public Void visitBreak(BreakTree node, Void p) {
    if (isMethodCode() && phase == PHASE_INSIDE_SELECTION && !treesSeensInSelection.contains(info.getTreeUtilities().getBreakContinueTarget(getCurrentPath()))) {
        selectionExits.add(getCurrentPath());
        hasBreaks = true;
    }
    return super.visitBreak(node, p);
}
项目:incubator-netbeans    文件:Utilities.java   
@Override
public Boolean visitBreak(BreakTree node, Void p) {
    Tree target = info.getTreeUtilities().getBreakContinueTarget(getCurrentPath());
    boolean known = seenTrees.contains(target);
    if (known) {
        targetTrees.add(target);
    }
    return !known;
}
项目:incubator-netbeans    文件:EvaluatorVisitor.java   
@Override
public Mirror visitBreak(BreakTree arg0, EvaluationContext evaluationContext) {
    Name label = arg0.getLabel();
    if (label != null) {
        Assert.error(arg0, "unsupported");
        return null;
    }
    return new Break();
}
项目:javaide    文件:JavaInputAstVisitor.java   
@Override
public Void visitBreak(BreakTree node, Void unused) {
    sync(node);
    builder.open(plusFour);
    token("break");
    if (node.getLabel() != null) {
        builder.breakOp(" ");
        visit(node.getLabel());
    }
    builder.close();
    token(";");
    return null;
}
项目:error-prone    文件:ErrorProneScanner.java   
@Override
public Void visitBreak(BreakTree tree, VisitorState visitorState) {
  VisitorState state = visitorState.withPath(getCurrentPath());
  for (BreakTreeMatcher matcher : breakMatchers) {
    if (!isSuppressed(matcher, state)) {
      try {
        reportMatch(matcher.matchBreak(tree, state), tree, state);
      } catch (Throwable t) {
        handleError(matcher, t);
      }
    }
  }
  return super.visitBreak(tree, state);
}
项目:error-prone    文件:UBreak.java   
@Override
public Choice<Unifier> visitBreak(BreakTree node, Unifier unifier) {
  if (getLabel() == null) {
    return Choice.condition(node.getLabel() == null, unifier);
  } else {
    CharSequence boundName = unifier.getBinding(key());
    return Choice.condition(
        boundName != null && node.getLabel().contentEquals(boundName), unifier);
  }
}
项目:error-prone    文件:ControlFlowVisitor.java   
@Override
public Result visitBreak(BreakTree node, BreakContext cxt) {
  if (cxt.internalLabels.contains(node.getLabel())
      || (node.getLabel() == null && cxt.loopDepth > 0)) {
    return NEVER_EXITS;
  } else {
    return MAY_BREAK_OR_RETURN;
  }
}
项目:error-prone    文件:Finally.java   
@Override
public Description matchBreak(BreakTree tree, VisitorState state) {
  if (new FinallyJumpMatcher((JCBreak) tree).matches(tree, state)) {
    return describeMatch(tree);
  }
  return Description.NO_MATCH;
}
项目:error-prone-aspirator    文件:Finally.java   
@Override
public Description matchBreak(BreakTree tree, VisitorState state) {
  if (new FinallyJumpMatcher((JCBreak) tree).matches(tree, state)) {
    return describeMatch(tree, NO_FIX);
  }
  return Description.NO_MATCH;
}
项目:bazel    文件:CFGBuilder.java   
@Override
public Node visitBreak(BreakTree tree, Void p) {
    Name label = tree.getLabel();
    if (label == null) {
        assert breakTargetL != null : "no target for break statement";

        extendWithExtendedNode(new UnconditionalJump(breakTargetL));
    } else {
        assert breakLabels.containsKey(label);

        extendWithExtendedNode(new UnconditionalJump(breakLabels.get(label)));
    }

    return null;
}
项目:compile-testing    文件:TreeDiffer.java   
@Override
public Void visitBreak(BreakTree expected, Tree actual) {
  Optional<BreakTree> other = checkTypeAndCast(expected, actual);
  if (!other.isPresent()) {
    addTypeMismatch(expected, actual);
    return null;
  }

  checkForDiff(namesEqual(expected.getLabel(), other.get().getLabel()),
      "Expected label on break statement to be <%s> but was <%s>.",
      expected.getLabel(), other.get().getLabel());
  return null;
}
项目:compile-testing    文件:MoreTrees.java   
@Override
public Optional<TreePath> visitBreak(@Nullable BreakTree node, Void v) {
  if (node == null) {
    return Optional.absent();
  }

  return isMatch(node, node.getLabel()) ? currentPathPlus(node) : Optional.<TreePath>absent();
}
项目:incubator-netbeans    文件:NCLOCVisitor.java   
@Override
public Object visitBreak(BreakTree node, Object p) {
    statements++;
    return super.visitBreak(node, p);
}
项目:incubator-netbeans    文件:PreconditionsChecker.java   
@Override
public Tree visitBreak(BreakTree that, Trees trees) {
    this.hasBreaks = true;
    return super.visitBreak(that, trees);

}
项目:incubator-netbeans    文件:InfiniteRecursion.java   
@Override
public State visitBreak(BreakTree node, Void p) {
    StatementTree target = ci.getTreeUtilities().getBreakContinueTarget(getCurrentPath());
    breakContinueJumps.add(target);
    return State.NO;
}
项目:incubator-netbeans    文件:ExpectedTypeResolver.java   
@Override
public List<? extends TypeMirror> visitBreak(BreakTree node, Object p) {
    return null;
}
项目:openjdk-jdk10    文件:CompletenessStressTest.java   
private boolean isLegal(StatementTree st) {
    return !(st instanceof ReturnTree) &&
            !(st instanceof ContinueTree) && !(st instanceof BreakTree);
}
项目:openjdk9    文件:CompletenessStressTest.java   
private boolean isLegal(StatementTree st) {
    return !(st instanceof ReturnTree) &&
            !(st instanceof ContinueTree) && !(st instanceof BreakTree);
}
项目:oblivion-netbeans-plugin    文件:ApexTreeVisitorAdapter.java   
@Override
public R visitBreak(BreakTree bt, P p) {
    return null;
}
项目:oblivion-netbeans-plugin    文件:TreeFinder.java   
@Override
public List<T> visitBreak(BreakTree node, T p) {
    return checkForCriteria(node);
}
项目:oblivion-netbeans-plugin    文件:ApexTreeFactory.java   
@Override
public BreakTree createBreak() {
    return new BreakTreeImpl();
}
项目:adalid    文件:CodeAnalyzerTreeVisitor.java   
@Override
public Object visitBreak(BreakTree t, Trees p) {
    info("BreakTree" + CL + t.getKind() + SP + t);
    return super.visitBreak(t, p);
}
项目:error-prone    文件:Reachability.java   
@Override
public Boolean visitBreak(BreakTree tree, Void unused) {
  breaks.add(skipLabel(requireNonNull(((JCTree.JCBreak) tree).target)));
  return false;
}
项目:error-prone    文件:UTemplater.java   
@Override
public UBreak visitBreak(BreakTree tree, Void v) {
  return UBreak.create(tree.getLabel());
}
项目:kan-java    文件:VisitBreakHook.java   
void visit(BreakTree node, List<ErrMsg> errMsgs, GlobalContext globalCtx, Closure<List<Map<String, Long>>> resolveRowAndCol,
Closure<Void> setError);
项目:checker-framework    文件:PurityChecker.java   
@Override
public PurityResult visitBreak(BreakTree node, PurityResult p) {
    return p;
}
项目:bazel    文件:PurityChecker.java   
@Override
public PurityResult visitBreak(BreakTree node, PurityResult p) {
    return p;
}
项目:compile-testing    文件:Breadcrumbs.java   
@Override
public String visitBreak(BreakTree reference, Void v) {
  return (reference != null) ? detailedKindString(reference, reference.getLabel()) : "";
}
项目:yield4j    文件:JavaTreeBuilderNew.java   
@Override
public Wrapper visitBreak(BreakTree arg0, Void arg1) {
    Name label = arg0.getLabel();
    return new BreakWrapper(arg0, label != null ? label.toString()
            : null);
}
项目:incubator-netbeans    文件:Flow.java   
public Boolean visitBreak(BreakTree node, ConstructorData p) {
    super.visitBreak(node, p);

    StatementTree target = info.getTreeUtilities().getBreakContinueTarget(getCurrentPath());

    resumeAfter(target, variable2State);

    variable2State = new HashMap< Element, State>();

    return null;
}
项目:oblivion-netbeans-plugin    文件:TreeFactory.java   
/**
 * Creates a tree node for a 'break' statement.
 * @return
 */
BreakTree createBreak();