@Override public void init() { super.init(); initWasCalled = true; }
/** * {@inheritDoc} Creates child module. * @noinspection ChainOfInstanceofChecks */ @Override public void setupChild(Configuration childConf) throws CheckstyleException { final String name = childConf.getName(); final Object module = moduleFactory.createModule(name); if (module instanceof AutomaticBean) { final AutomaticBean bean = (AutomaticBean) module; bean.contextualize(childContext); bean.configure(childConf); } if (module instanceof AbstractCheck) { final AbstractCheck check = (AbstractCheck) module; check.init(); registerCheck(check); } else if (module instanceof TreeWalkerFilter) { final TreeWalkerFilter filter = (TreeWalkerFilter) module; filters.add(filter); } else { throw new CheckstyleException( "TreeWalker is not allowed as a parent of " + name + " Please review 'Parent Module' section for this Check in web" + " documentation if Check is standard."); } }
/** * {@inheritDoc} Creates child module. * @noinspection ChainOfInstanceofChecks */ @Override public void setupChild(Configuration childConf) throws CheckstyleException { final String name = childConf.getName(); final Object module = moduleFactory.createModule(name); if (module instanceof AutomaticBean) { final AutomaticBean bean = (AutomaticBean) module; bean.contextualize(childContext); bean.configure(childConf); } if (module instanceof AbstractCheck) { final AbstractCheck check = (AbstractCheck) module; check.init(); registerCheck(check); } else if (module instanceof TreeWalkerFilter) { final TreeWalkerFilter filter = (TreeWalkerFilter) module; filters.add(filter); } else { throw new CheckstyleException( "TreeWalker is not allowed as a parent of " + name + " Please review 'Parent Module' section for this Check in web" + " documentation if Check is standard."); } }
@Override public void setupChild(Configuration childConf) throws CheckstyleException { ModuleFactory moduleFactory = createModuleFactory(); String name = childConf.getName(); Object module = moduleFactory.createModule(name); if (!(module instanceof AbstractCheck)) { throw new CheckstyleException("OptionalCheck is not allowed as a parent of " + name + " Please review 'Parent Module' section for this Check."); } if (this.check != null) { throw new CheckstyleException("Can only make a single check optional"); } AbstractCheck check = (AbstractCheck) module; check.contextualize(this.childContext); check.configure(childConf); check.init(); this.check = check; }