File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/sound/SoundTask.java | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/javacc/JavaCC.java | |||
Method name: File getSource()
|
Method name: int getArchiveLocationIndex(File)
|
|||
Number of AST nodes: 4 | Number of AST nodes: 4 | |||
1 | for (int i = 0; i < entries.length; i++) {↵ | 1 | for (int i = 0; i < ARCHIVE_LOCATIONS.length; i++) {↵ | |
2 | File f = new File(source, entries[i]);↵ | 2 | File f = new File(↵ | |
3 | ↵ | 3 | home, ARCHIVE_LOCATIONS[i]);↵ | |
4 | if (f.isFile()) {↵ | 4 | if (f.exists()) {↵ | |
5 | files.addElement(f);↵ | 5 | ↵ | |
6 | }↵ | |||
7 | ↵ | 6 | return i;↵ | |
7 | }↵ | |||
8 | } | 8 |
| |
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.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 8 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | for (int i = 0; i < entries.length; i++) |
| 3 | for (int i = 0; i < ARCHIVE_LOCATIONS.length; i++) | |||||||||||||
7 | File f = new File(source, entries[i]); |
| 4 | File f = new File(home, ARCHIVE_LOCATIONS[i]); | |||||||||||||
8 | if (f.isFile()) |
| 5 | if (f.exists()) | |||||||||||||
|
| 6 | return i; | ||||||||||||||
9 | files.addElement(f); |
| |
Row | Violation |
---|---|
1 | Expression f.isFile() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression f.exists() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement return i; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched return i; |
5 | Unmatched statement files.addElement(f); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Clone fragment #1 returns variable f with type java.io.File , while Clone fragment #2 returns variable i with type int |