@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 + "\"."); } } }
PostStatementVisitor(CheckerContext context) { super(context.getState()); }
PreStatementVisitor(CheckerContext context) { super(context.getState()); constraintManager = context.getConstraintManager(); }