/** * Creates {@link Checker} instance based on the given {@link Configuration} instance. * @param moduleConfig {@link Configuration} instance. * @param moduleCreationOption {@code IN_TREEWALKER} if the {@code moduleConfig} should be added * under {@link TreeWalker}. * @return {@link Checker} instance based on the given {@link Configuration} instance. * @throws Exception if an exception occurs during checker configuration. */ public final Checker createChecker(Configuration moduleConfig, ModuleCreationOption moduleCreationOption) throws Exception { final Checker checker = new Checker(); checker.setModuleClassLoader(Thread.currentThread().getContextClassLoader()); if (moduleCreationOption == ModuleCreationOption.IN_TREEWALKER) { final Configuration dc = createTreeWalkerConfig(moduleConfig); checker.configure(dc); } else if (ROOT_MODULE_NAME.equals(moduleConfig.getName())) { checker.configure(moduleConfig); } else { final Configuration dc = createRootConfig(moduleConfig); checker.configure(dc); } checker.addListener(new BriefUtLogger(stream)); return checker; }