extraFields = new Vector(); for (int i = 0; i < fields.length; i++) { extraFields.addElement(fields[i]); } setExtra();
defaultExcludes = new Vector(); for (int i = 0; i < DEFAULTEXCLUDES.length; i++) { defaultExcludes.add(DEFAULTEXCLUDES[i]); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/zip/ZipEntry.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/DirectoryScanner.java
Method name: void setExtraFields(ZipExtraField[]) Method name: void resetDefaultExcludes()
Number of AST nodes: 4 Number of AST nodes: 3
1
extraFields = new Vector();
1
defaultExcludes = new Vector();
2
        for (int i = 0; i < fields.length; i++) {
2
        for (int i = 0; i < DEFAULTEXCLUDES.length; i++) {
3
            extraFields.addElement(fields[i]);
3
            
4
        }
5
        setExtra();
4
defaultExcludes.add(DEFAULTEXCLUDES[i]);
5
        }
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 comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    extraFields = new Vector();
    1
    extraFields = new Vector();
    1
    defaultExcludes = new Vector();
    Differences
    Expression1Expression2Difference
    extraFieldsdefaultExcludesVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression extraFields is a field being modified, and thus it cannot be parameterized
    Expression defaultExcludes is a field being modified, and thus it cannot be parameterized
    1
    defaultExcludes = new Vector();
    2
    for (int i = 0; i < fields.length; i++)
    2
    for (int i = 0; i < fields.length; i++)
    2
    for (int i = 0; i < DEFAULTEXCLUDES.length; i++)
    Differences
    Expression1Expression2Difference
    fieldsDEFAULTEXCLUDESVARIABLE_NAME_MISMATCH
    org.apache.tools.zip.ZipExtraField[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.zip.ZipExtraField[] of variable fields does not match with type java.lang.String[] of variable DEFAULTEXCLUDES
    • Make classes org.apache.tools.zip.ZipExtraField[] and java.lang.String[] extend a common superclass
    2
    for (int i = 0; i < DEFAULTEXCLUDES.length; i++)
                                                                                          
    3
    defaultExcludes.add(DEFAULTEXCLUDES[i]);
    Preondition Violations
    Unmatched statement defaultExcludes.add(DEFAULTEXCLUDES[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    defaultExcludes.add(DEFAULTEXCLUDES[i]);
    3
    extraFields.addElement(fields[i]);
    3
    extraFields.addElement(fields[i]);
    Preondition Violations
    Unmatched statement extraFields.addElement(fields[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                              
    4
    setExtra();
                                
    Precondition Violations (5)
    Row Violation
    1Expression extraFields is a field being modified, and thus it cannot be parameterized
    2Expression defaultExcludes is a field being modified, and thus it cannot be parameterized
    3Type org.apache.tools.zip.ZipExtraField[] of variable fields does not match with type java.lang.String[] of variable DEFAULTEXCLUDES
    4Unmatched statement defaultExcludes.add(DEFAULTEXCLUDES[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement extraFields.addElement(fields[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted