File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Manifest.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/EchoProperties.java | |||
Method name: Object clone()
|
Method name: List sortProperties(Properties)
|
|||
Number of AST nodes: 8 | Number of AST nodes: 7 | |||
1 | Section cloned = new Section();↵ | |||
2 | cloned.setName(name);↵ | |||
3 | ↵ | 1 | List sorted = new ArrayList(props.size());↵ | |
4 | Enumeration e = getAttributeKeys();↵ | 2 | Enumeration e = props.propertyNames();↵ | |
5 | while (e.hasMoreElements()) {↵ | 3 | while (e.hasMoreElements()) {↵ | |
6 | String key = (String) e.nextElement();↵ | 4 | String name = (String) e.nextElement();↵ | |
7 | Attribute attribute = getAttribute(key);↵ | 5 | ↵ | |
8 | cloned.storeAttribute(new Attribute(attribute.getName(),↵ | |||
9 | attribute.getValue()));↵ | |||
10 | }↵ | |||
11 | ↵ | 6 | sorted.add(new Tuple(name, props.getProperty(name)));↵ | |
7 | }↵ | |||
8 | Collections.sort(sorted);↵ | |||
12 | return cloned; | 9 | return sorted; | |
See real code fragment | See real code fragment |
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 |
Number of node comparisons | 28 |
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 6 |
Number of unmapped statements in the second code fragment | 5 |
Time elapsed for statement mapping (ms) | 1.5 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | List sorted = new ArrayList(props.size()); | ||||||||||||
1 | Section cloned = new Section(); | | ||||||||||||
| 2 | Enumeration e = props.propertyNames(); | ||||||||||||
2 | cloned.setName(name); | | ||||||||||||
3 | Enumeration e = getAttributeKeys(); | | ||||||||||||
4 | while (e.hasMoreElements()) | 3 | while (e.hasMoreElements()) | |||||||||||
5 | String key = (String)e.nextElement(); |
| 4 | String name = (String)e.nextElement(); | ||||||||||
|
| 5 | sorted.add(new Tuple(name, props.getProperty(name))); | |||||||||||
6 | Attribute attribute = getAttribute(key); |
| | |||||||||||
7 | cloned.storeAttribute(new Attribute(attribute.getName(), attribute.getValue())); |
| | |||||||||||
| 6 | Collections.sort(sorted); | ||||||||||||
|
| 7 | return sorted; | |||||||||||
8 | return cloned; |
| |
Row | Violation |
---|---|
1 | Unmatched statement sorted.add(new Tuple(name,props.getProperty(name))); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement Attribute attribute=getAttribute(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement cloned.storeAttribute(new Attribute(attribute.getName(),attribute.getValue())); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched return sorted; |
5 | Unmatched return cloned; |