NormalizedFile[] smartFiles = new NormalizedFile[files.length]; for (int i = 0; i < files.length; i++) { smartFiles[i] = new NormalizedFile(files[i].getPath()); } return smartFiles;
Type[] result = new Type[parameterTypes.length]; for (int i = 0; i < result.length; i++) { result[i] = Type.getType(parameterTypes[i]); } return result;
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/javasupport/proxy/JavaProxyClassFactory.java
Method name: File[] listFiles(FileFilter) Method name: Type[] toType(Class[])
Number of AST nodes: 4 Number of AST nodes: 4
1
NormalizedFile[] smartFiles = new NormalizedFile[files.length];
1
Type[] result = new Type[parameterTypes.length];
2
            for (int i = 0; i < files.length; i++) {
2
        for (int i = 0; i < result.length; i++) {
3
                smartFiles[i] = new NormalizedFile(files[i].getPath());
3
            result[i] = Type.getType(parameterTypes[i]);
4
            }
4
        
5
    
5
}
6
        return smartFiles;
6
        return result;
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.2
Clones locationClones are in different classes
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                      
    1
    Type[] result = new Type[parameterTypes.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++)
    2
    for (int i = 0; i < result.length; i++)
    Differences
    Expression1Expression2Difference
    filesresultVARIABLE_NAME_MISMATCH
    java.io.File[]org.objectweb.asm.Type[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.File[] of variable files does not match with type org.objectweb.asm.Type[] of variable result
    • Make classes java.io.File[] and org.objectweb.asm.Type[] extend a common superclass
    2
    for (int i = 0; i < result.length; i++)
                                                                                              
    3
    result[i] = Type.getType(parameterTypes[i]);
    Preondition Violations
    Unmatched statement result[i]=Type.getType(parameterTypes[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    result[i] = Type.getType(parameterTypes[i]);
    6
    smartFiles[i] = new NormalizedFile(files[i].getPath());
    6
    smartFiles[i] = new NormalizedFile(files[i].getPath());
    Preondition Violations
    Unmatched statement smartFiles[i]=new NormalizedFile(files[i].getPath()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                    
                                      
    4
    return result;
    Preondition Violations
    Unmatched return result;
    4
    return result;
    7
    return smartFiles;
    7
    return smartFiles;
    Preondition Violations
    Unmatched return smartFiles;
                                              
    Precondition Violations (5)
    Row Violation
    1Type java.io.File[] of variable files does not match with type org.objectweb.asm.Type[] of variable result
    2Unmatched statement result[i]=Type.getType(parameterTypes[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement smartFiles[i]=new NormalizedFile(files[i].getPath()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return result;
    5Unmatched return smartFiles;