File[] files = super.listFiles(filter);
if (files == null) {
return null;
} else {
NormalizedFile[] smartFiles = new NormalizedFile[files.length];
for (int i = 0; i < files.length; i++) {
smartFiles[i] = new NormalizedFile(files[i].getPath());
}
return smartFiles;
}
File[] files = super.listFiles(filter);
if (files == null) {
return null;
} else {
NormalizedFile[] smartFiles = new NormalizedFile[files.length];
for (int i = 0; i < files.length; i++) {
smartFiles[i] = new NormalizedFile(files[i].getPath());
}
return smartFiles;
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/util/NormalizedFile.java
|
|
File path: /jruby-1.4.0/src/org/jruby/util/NormalizedFile.java
|
Method name: File[] listFiles(FileFilter)
|
|
Method name: File[] listFiles(FilenameFilter)
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | File[] files = super.listFiles(filter);↵ | | 1 | File[] files = super.listFiles(filter);↵
|
2 | ↵ | | 2 | ↵
|
3 | if (files == null) {↵ | | 3 | if (files == null) {↵
|
4 | return null;↵ | | 4 | return null;↵
|
5 | } else {↵ | | 5 | } else {↵
|
6 | NormalizedFile[] smartFiles = new NormalizedFile[files.length];↵ | | 6 | NormalizedFile[] smartFiles = new NormalizedFile[files.length];↵
|
7 | for (int i = 0; i < files.length; i++) {↵ | | 7 | for (int i = 0; i < files.length; i++) {↵
|
8 | smartFiles[i] = new NormalizedFile(files[i].getPath());↵ | | 8 | smartFiles[i] = new NormalizedFile(files[i].getPath());↵
|
9 | }↵ | | 9 | }↵
|
10 | return smartFiles;↵ | | 10 | return smartFiles;↵
|
11 | } | | 11 | }
|
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 21 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 1.4 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | File[] files = super.listFiles(filter); | | 1 | File[] files = super.listFiles(filter); |
2 | if (files == null) | | 2 | if (files == null) |
3 | | | 3 | |
| | | | |
4 | NormalizedFile[] smartFiles = new NormalizedFile[files.length]; | | 4 | NormalizedFile[] smartFiles = new NormalizedFile[files.length]; |
5 | for (int i = 0; i < files.length; i++) | | 5 | for (int i = 0; i < files.length; i++) |
6 | smartFiles[i] = new NormalizedFile(files[i].getPath()); | | 6 | smartFiles[i] = new NormalizedFile(files[i].getPath()); |
7 | | | 7 | |
Precondition Violations (1)
Row |
Violation |
1 | Type java.io.FileFilter of variable filter does not match with type java.io.FilenameFilter of variable filter |