fakePlugin.addDetectorFactory(detectorFactory); dfc.registerDetector(detectorFactory); if (!dfc.factoryIterator().hasNext() || fakePlugin.getDetectorFactories().isEmpty()) { throw new IllegalStateException();
public void print() throws IOException { // Ensure bug patterns are loaded DetectorFactoryCollection factories = DetectorFactoryCollection.instance(); // Find all bug patterns reported by at least one non-disabled detector. Collection<BugPattern> enabledPatternSet = new HashSet<BugPattern>(); for (Iterator<DetectorFactory> i = factories.factoryIterator(); i.hasNext();) { DetectorFactory factory = i.next(); if (isEnabled(factory)) { enabledPatternSet.addAll(factory.getReportedBugPatterns()); } } prologue(); Iterator<BugPattern> i = DetectorFactoryCollection.instance().bugPatternIterator(); while (i.hasNext()) { BugPattern bugPattern = i.next(); if (!enabledPatternSet.contains(bugPattern)) { continue; } emit(bugPattern); } epilogue(); }