if (inheritRefs) {
for (e = thisReferences.keys(); e.hasMoreElements();) {
String key = (String) e.nextElement();
if (newReferences.containsKey(key)) {
continue;
}
copyReference(key, key);
newProject.inheritIDReferences(getProject());
}
}
for (Iterator r = nextRC(rcIter).iterator(); r.hasNext();) {
Object o = r.next();
if (asString) {
o = o.toString();
}
if (!(union.contains(o))) {
union.add(o);
}
}
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Ant.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/Union.java
|
Method name: void addReferences()
|
|
Method name: Collection getCollection(boolean)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 6
|
|
1 | if (inheritRefs) {↵ | | |
|
2 | for (e = thisReferences.keys(); e.hasMoreElements();) {↵ | | 1 | for (Iterator r = nextRC(rcIter).iterator(); r.hasNext();) {↵
|
3 | String key = (String) e.nextElement();↵ | | 2 | ↵
|
4 | if (newReferences.containsKey(key)↵ | | 3 | Object o = r.next();↵
|
5 | ) {↵ | | 4 | if (asString) {↵
|
6 | continue;↵ | | 5 | o = o.toString();↵
|
7 | }↵ | | 6 | }↵
|
8 | copyReference(key, key);↵ | | 7 | ↵
|
9 | newProject.inheritIDReferences(getProject()↵ | | 8 | if (!(union.contains(o))) {↵
|
10 | );↵ | | 9 | union.add(o);↵
|
11 | }↵ | | 10 | ↵
|
| | | 11 | }↵
|
12 | } | | 12 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 7 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 0.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
| | | 7 | Object o = r.next(); |
20 | String key = (String)e.nextElement(); | | | |
21 | if (newReferences.containsKey(key)) | | 8 | if (asString) |
| | | 9 | |
22 | | | | |
Precondition Violations (2)
Row |
Violation |
1 | Unmatched statement String key=(String)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched continue; |