/** * Notify checks that we are about to begin walking a tree. * @param rootAST the root of the tree. * @param contents the contents of the file the AST was generated from. * @param astState state of AST. */ private void notifyBegin(DetailAST rootAST, FileContents contents, AstState astState) { final Set<AbstractCheck> checks; if (astState == AstState.WITH_COMMENTS) { checks = commentChecks; } else { checks = ordinaryChecks; } for (AbstractCheck check : checks) { check.setFileContents(contents); check.clearMessages(); check.beginTree(rootAST); } }
@Test public void testClearMessages() { final AbstractCheck check = new DummyAbstractCheck(); check.log(1, "key", "args"); Assert.assertEquals("Invalid message size", 1, check.getMessages().size()); check.clearMessages(); Assert.assertEquals("Invalid message size", 0, check.getMessages().size()); }
/** * Notify checks that we are about to begin walking a tree. * @param rootAST the root of the tree. * @param contents the contents of the file the AST was generated from. * @param astState state of AST. */ private void notifyBegin(DetailAST rootAST, FileContents contents, AstState astState) { final Set<AbstractCheck> checks; if (astState == AstState.WITH_COMMENTS) { checks = commentChecks; } else { checks = ordinaryChecks; } for (AbstractCheck check : checks) { check.setFileContents(contents); check.clearMessages(); check.beginTree(rootAST); } }
@Override public void beginTree(DetailAST rootAST) { this.check.setFileContents(getFileContents()); this.check.clearMessages(); this.check.beginTree(rootAST); }