final File[] files = super.listFiles(filter); if (files == null) { return null; } JRubyFile[] smartFiles = new JRubyFile[files.length]; for (int i = 0,j = files.length; i < j; i++) { smartFiles[i] = createNoUnicodeConversion(super.getAbsolutePath(), files[i].getPath()); } return smartFiles;
final File[] files = super.listFiles(filter); if (files == null) { return null; } JRubyFile[] smartFiles = new JRubyFile[files.length]; for (int i = 0,j = files.length; i < j; i++) { smartFiles[i] = createNoUnicodeConversion(super.getAbsolutePath(), files[i].getPath()); } return smartFiles;
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/util/JRubyFile.java File path: /jruby-1.4.0/src/org/jruby/util/JRubyFile.java
Method name: File[] listFiles(FileFilter) Method name: File[] listFiles(FilenameFilter)
Number of AST nodes: 7 Number of AST nodes: 7
1
final File[] files = super.listFiles(filter);
1
final File[] files = super.listFiles(filter);
2
        if (files == null) {
2
        if (files == null) {
3
            return null;
3
            return null;
4
        }
4
        }
5
        
5
        
6
        JRubyFile[] smartFiles = new JRubyFile[files.length];
6
        JRubyFile[] smartFiles = new JRubyFile[files.length];
7
        for (int i = 0,j = files.length; i < j; i++) {
7
        for (int i = 0,j = files.length; i < j; i++) {
8
            smartFiles[i] = createNoUnicodeConversion(super.getAbsolutePath(), files[i].getPath());
8
            smartFiles[i] = createNoUnicodeConversion(super.getAbsolutePath(), files[i].getPath());
9
        }
9
        }
10
        return smartFiles;
10
        return smartFiles;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    final File[] files = super.listFiles(filter);
    1
    final File[] files = super.listFiles(filter);
    1
    final File[] files = super.listFiles(filter);
    Differences
    Expression1Expression2Difference
    java.io.FileFilterjava.io.FilenameFilterVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.FileFilter of variable filter does not match with type java.io.FilenameFilter of variable filter
    • Make classes java.io.FileFilter and java.io.FilenameFilter extend a common superclass
    1
    final File[] files = super.listFiles(filter);
    2
    if (files == null)
    2
    if (files == null)
    3
    return null;
    3
    return null;
    4
    JRubyFile[] smartFiles = new JRubyFile[files.length];
    4
    JRubyFile[] smartFiles = new JRubyFile[files.length];
    5
    for (int i = 0, j = files.length; i < j; i++)
    5
    for (int i = 0, j = files.length; i < j; i++)
    6
    smartFiles[i] = createNoUnicodeConversion(super.getAbsolutePath(), files[i].getPath());
    6
    smartFiles[i] = createNoUnicodeConversion(super.getAbsolutePath(), files[i].getPath());
    7
    return smartFiles;
    7
    return smartFiles;
    Precondition Violations (1)
    Row Violation
    1Type java.io.FileFilter of variable filter does not match with type java.io.FilenameFilter of variable filter