public boolean isInstanceHashConsistent() { return oldInstanceHash == null || getInstanceHash().equals(oldInstanceHash); }
@Override @Deprecated public BugInstance lookupFromUniqueId(String uniqueId) { for (BugInstance bug : bugSet) { if (bug.getInstanceHash().equals(uniqueId)) { return bug; } } return null; }
public void forgetLastBug() { Data d = map.get(lastBug); if (d != null) { d.allSource.remove(lastSourceLine); if (d.allSource.isEmpty()) { map.remove(lastBug); hashes.remove(lastBug.getInstanceHash()); } } lastBug = null; lastSourceLine = null; }
@Override public void reportBug(@Nonnull BugInstance bugInstance) { String instanceHash = bugInstance.getInstanceHash(); if (!excludedHashes.contains(instanceHash)) { getDelegate().reportBug(bugInstance); } } }
@Override public BugInstance findBug(String instanceHash, String bugType, int lineNumber) { for (BugInstance bug : bugSet) { if (bug.getInstanceHash().equals(instanceHash) && bug.getBugPattern().getType().equals(bugType) && bug.getPrimarySourceLineAnnotation().getStartLine() == lineNumber) { return bug; } } return null; }
public void computeBugHashes() { if (preciseHashOccurrenceNumbersAvailable) { return; } invalidateHashes(); HashMap<String, Integer> seen = new HashMap<>(); for (BugInstance bugInstance : getCollection()) { String hash = bugInstance.getInstanceHash(); Integer count = seen.get(hash); if (count == null) { bugInstance.setInstanceOccurrenceNum(0); seen.put(hash, 0); } else { bugInstance.setInstanceOccurrenceNum(count + 1); seen.put(hash, count + 1); } } for (BugInstance bugInstance : getCollection()) { bugInstance.setInstanceOccurrenceMax(seen.get(bugInstance.getInstanceHash())); } preciseHashOccurrenceNumbersAvailable = true; }
for (BugInstance b : bugCollection.getCollection()) { if (b.getFirstVersion() != 0 || b.getLastVersion() != -1) { List<BugInstance> lst = map.get(b.getInstanceHash()); if (lst == null) { lst = new LinkedList<>(); map.put(b.getInstanceHash(), lst);
/** * @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()); } }
Data d = map.get(bug); if (d == null) { String hash = bug.getInstanceHash(); BugInstance conflictingBug = hashes.get(hash); if (conflictingBug != null) {
static public void merge(HashSet<String> hashes, SortedBugCollection into, SortedBugCollection from) { for (BugInstance bugInstance : from.getCollection()) { if (hashes == null || hashes.add(bugInstance.getInstanceHash())) { into.add(bugInstance); } } ProjectStats stats = into.getProjectStats(); ProjectStats stats2 = from.getProjectStats(); stats.addStats(stats2); Project project = into.getProject(); Project project2 = from.getProject(); project.add(project2); for(AnalysisError error : from.getErrors()) { into.addError(error); } return; }
if (excludedInstanceHashes.contains(bug.getInstanceHash())) { return false; return false; if (hashesFromFile != null && !hashesFromFile.contains(bug.getInstanceHash())) { return false;
attributeList.addAttribute("instanceHash", getInstanceHash()); attributeList.addAttribute("instanceOccurrenceNum", Integer.toString(getInstanceOccurrenceNum())); attributeList.addAttribute("instanceOccurrenceMax", Integer.toString(getInstanceOccurrenceMax()));
BugInstance bug = bc.getCollection().iterator().next(); assertEquals("MS_MUTABLE_ARRAY", bug.getBugPattern().getType()); assertEquals("1acc5c5b9b7ab9efacede805afe1e53a", bug.getInstanceHash()); assertEquals(16, bug.getBugRank());
a.accept(visitor); result.setOldInstanceHash(hashData(b.getInstanceHash())); result.setHistory(b); return result;
BugInstance bug = bc.getCollection().iterator().next(); assertEquals("MS_MUTABLE_ARRAY", bug.getBugPattern().getType()); assertEquals("1acc5c5b9b7ab9efacede805afe1e53a", bug.getInstanceHash()); assertEquals(16, bug.getBugRank());
BugInstance bug = bc.getCollection().iterator().next(); assertEquals("MS_MUTABLE_ARRAY", bug.getBugPattern().getType()); assertEquals("1acc5c5b9b7ab9efacede805afe1e53a", bug.getInstanceHash()); assertEquals(16, bug.getBugRank());
BugInstance bug = bc.getCollection().iterator().next(); assertEquals("MS_MUTABLE_ARRAY", bug.getBugPattern().getType()); assertEquals("1acc5c5b9b7ab9efacede805afe1e53a", bug.getInstanceHash()); assertEquals(16, bug.getBugRank());
@Override @Deprecated public BugInstance lookupFromUniqueId(String uniqueId) { for (BugInstance bug : bugSet) { if (bug.getInstanceHash().equals(uniqueId)) { return bug; } } return null; }
@Override public void reportBug(@Nonnull BugInstance bugInstance) { String instanceHash = bugInstance.getInstanceHash(); if (!excludedHashes.contains(instanceHash)) { getDelegate().reportBug(bugInstance); } } }
@Override public BugInstance findBug(String instanceHash, String bugType, int lineNumber) { for (BugInstance bug : bugSet) { if (bug.getInstanceHash().equals(instanceHash) && bug.getBugPattern().getType().equals(bugType) && bug.getPrimarySourceLineAnnotation().getStartLine() == lineNumber) { return bug; } } return null; }