public static void trimToMaxRank(BugCollection origCollection, int maxRank) { for (Iterator<BugInstance> i = origCollection.getCollection().iterator(); i.hasNext();) { BugInstance b = i.next(); if (BugRanker.findRank(b) > maxRank) { i.remove(); } } } }
public void removeBaselineBugs(BugCollection baselineCollection, BugCollection bugCollection) { matchBugs(baselineCollection, bugCollection); matchBugs(SortedBugCollection.BugInstanceComparator.instance, baselineCollection, bugCollection); matchBugs(versionInsensitiveBugComparator, baselineCollection, bugCollection); for (Iterator<BugInstance> i = bugCollection.getCollection().iterator(); i.hasNext();) { BugInstance bug = i.next(); if (matchedOldBugs.containsKey(bug)) { i.remove(); } } }
public ObfuscateBugs execute() { ProjectPackagePrefixes foo = new ProjectPackagePrefixes(); for (BugInstance b : bugCollection.getCollection()) { foo.countBug(b); } foo.report(); return this; }
public TestingGround execute() { ProjectPackagePrefixes foo = new ProjectPackagePrefixes(); for (BugInstance b : bugCollection.getCollection()) { foo.countBug(b); } foo.report(); return this; }
for (BugInstance bug : origCollection.getCollection()) { if (!matchedOldBugs.containsKey(bug)) { if (matchOld.match(bug)) { for (BugInstance bug : newCollection.getCollection()) { if (!mapFromNewToOldBug.containsKey(bug)) {
/** * @param baseline * @throws IOException * @throws DocumentException */ public static void addToExcludedInstanceHashes(Set<String> instanceHashesToExclude, String baseline) throws IOException, DocumentException { Project project = new Project(); BugCollection origCollection; origCollection = new SortedBugCollection(project); origCollection.readXML(baseline); for (BugInstance b : origCollection.getCollection()) { instanceHashesToExclude.add(b.getInstanceHash()); } }
public RebornIssues execute() { for (BugInstance b : bugCollection.getCollection()) { if (b.getFirstVersion() != 0 || b.getLastVersion() != -1) { List<BugInstance> lst = map.get(b.getInstanceHash());
for (BugInstance bug : bugs.getCollection()) { SourceLineAnnotation source = bug.getPrimarySourceLineAnnotation();
Map<String, Integer> ncss = new TreeMap<>(); for (BugInstance b : origCollection.getCollection()) { String prefix = ClassName.extractPackagePrefix(b.getPrimaryClass().getPackageName(), prefixLength); Integer v = map.get(prefix);
/** * Test for expected warnings on ecj compiler (Eclipse) generated classes * Right now this test does nothing if Eclipse UI were not used to compile project. * The main purpose is for developers hacking in Eclipse to see if there are any unexpected * failures with Eclipse generated bytecode. It would be nice to make the test explicit by using * ecj command line compiler and *always* validate both bytecode kinds. */ @Test public void testAllRegressionFilesEcj() throws IOException, InterruptedException { setUpEngine("classesEclipse/"); engine.execute(); // If there are zero bugs, then something's wrong if (bugReporter.getBugCollection().getCollection().isEmpty()) { // TODO better to add ecj compiler and to compile classes with it on build, not with UI. System.err.println("No bugs were reported. Probably Eclipse was not used to compile the project"); } }
/** * Test for expected warnings on javac compiler generated classes */ @Test public void testAllRegressionFilesJavac() throws IOException, InterruptedException { setUpEngine("build/classes/java/main/"); engine.execute(); // If there are zero bugs, then something's wrong assertFalse("No bugs were reported. Something is wrong with the configuration", bugReporter.getBugCollection() .getCollection().isEmpty()); }
for (BugInstance bug : origCollection.getCollection()) { if (bug.getLastVersion() >= 0 && bug.getFirstVersion() > bug.getLastVersion()) { throw new IllegalStateException("Illegal Version range: " + bug.getFirstVersion() + ".." + bug.getLastVersion());
for (BugInstance bug : origCollection.getCollection()) { if (!matchedOldBugs.containsKey(bug)) { if (bug.isDead()) { for (BugInstance bug : newCollection.getCollection()) { BugInstance newBug = (BugInstance) bug.clone(); if (mapFromNewToOldBug.containsKey(bug)) { + newBug.getLastVersion()); int oldSize = resultCollection.getCollection().size(); resultCollection.add(newBug, false); int newSize = resultCollection.getCollection().size(); if (newSize != oldSize + 1) { System.out.println("Failed to add bug" + newBug.getMessage());
public BugInstance getBugByHash(String hash) { for (BugInstance instance : bugCollection.getCollection()) { if (instance.getInstanceHash().equals(hash)) { return instance; } } return null; }
public static void trimToMaxRank(BugCollection origCollection, int maxRank) { for (Iterator<BugInstance> i = origCollection.getCollection().iterator(); i.hasNext();) { BugInstance b = i.next(); if (BugRanker.findRank(b) > maxRank) { i.remove(); } } } }
public void removeBaselineBugs(BugCollection baselineCollection, BugCollection bugCollection) { matchBugs(baselineCollection, bugCollection); matchBugs(SortedBugCollection.BugInstanceComparator.instance, baselineCollection, bugCollection); matchBugs(versionInsensitiveBugComparator, baselineCollection, bugCollection); for (Iterator<BugInstance> i = bugCollection.getCollection().iterator(); i.hasNext();) { BugInstance bug = i.next(); if (matchedOldBugs.containsKey(bug)) { i.remove(); } } }
private FindBugsResult createBugList(BugCollectionBugReporter bugReporter) { final UsageCounter counter = new UsageCounter(); final List<BugInstance> bugs = bugReporter.getBugCollection().getCollection().stream() .filter(b -> counter.accept(collector.accept(b))) .sorted(BUG_COMPARATOR) .collect(toList()); collector.printUnusedWarning(counter); return new FindBugsResult(this, bugs, collector.unusedActions(counter)); } }
private FindBugsResult createBugList(BugCollectionBugReporter bugReporter) { final UsageCounter counter = new UsageCounter(); final List<BugInstance> bugs = bugReporter.getBugCollection().getCollection().stream() .filter(b -> counter.accept(collector.accept(b))) .sorted(BUG_COMPARATOR) .collect(toList()); collector.printUnusedWarning(counter); return new FindBugsResult(this, bugs, collector.unusedActions(counter)); } }
public ObfuscateBugs execute() { ProjectPackagePrefixes foo = new ProjectPackagePrefixes(); for (BugInstance b : bugCollection.getCollection()) { foo.countBug(b); } foo.report(); return this; }
public TestingGround execute() { ProjectPackagePrefixes foo = new ProjectPackagePrefixes(); for (BugInstance b : bugCollection.getCollection()) { foo.countBug(b); } foo.report(); return this; }