コード例 #1
0
 @Override
 public void checkEndOfExecutionPath(CheckerContext context, ConstraintManager constraintManager) {
   final List<ObjectConstraint> constraints =
       context.getState().getFieldConstraints(Status.OPENED);
   for (ObjectConstraint constraint : constraints) {
     Tree syntaxNode = constraint.syntaxNode();
     String name = null;
     if (syntaxNode.is(Tree.Kind.NEW_CLASS)) {
       name = ((NewClassTree) syntaxNode).identifier().symbolType().name();
     } else if (syntaxNode.is(Tree.Kind.METHOD_INVOCATION)) {
       name = ((MethodInvocationTree) syntaxNode).symbolType().name();
     }
     if (name != null) {
       context.reportIssue(syntaxNode, this, "Close this \"" + name + "\".");
     }
   }
 }
コード例 #2
0
 PostStatementVisitor(CheckerContext context) {
   super(context.getState());
 }
コード例 #3
0
 PreStatementVisitor(CheckerContext context) {
   super(context.getState());
   constraintManager = context.getConstraintManager();
 }