while (e.hasMoreElements()) { String key = (String) e.nextElement(); Attribute attribute = getAttribute(key); cloned.storeAttribute(new Attribute(attribute.getName(), attribute.getValue())); }
while (affectedClassEnum.hasMoreElements()) { String affectedClass = (String) affectedClassEnum.nextElement(); ClassFileInfo info = (ClassFileInfo) affectedClasses.get(affectedClass); log(" " + affectedClass + " in " + info.absoluteFile.getPath(), Project.MSG_DEBUG); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/Manifest.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/depend/Depend.java
Method name: Object clone() Method name: void dumpDependencies()
Number of AST nodes: 4 Number of AST nodes: 4
1
while (e.hasMoreElements()) {
1
while (affectedClassEnum.hasMoreElements()) {
2
                String key = (String) e.nextElement();
2
                String 
3
                Attribute attribute = getAttribute(key);
4
                cloned.storeAttribute(new Attribute(attribute.getName(),
3
affectedClass = (String) affectedClassEnum.nextElement();
4
                ClassFileInfo info
5
                    = (ClassFileInfo) affectedClasses.get(affectedClass);
5
                               
6
                log("    " + affectedClass + " in "
6
                     attribute.getValue()));
7
                    + info.absoluteFile.getPath(), Project.MSG_DEBUG);
7
            }
8
            }
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.1
Clones locationClones are in different classes
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    while (e.hasMoreElements())
    4
    while (e.hasMoreElements())
    8
    while (affectedClassEnum.hasMoreElements())
    Differences
    Expression1Expression2Difference
    eaffectedClassEnumVARIABLE_NAME_MISMATCH
    8
    while (affectedClassEnum.hasMoreElements())
    5
    String key = (String)e.nextElement();
    5
    String key = (String)e.nextElement();
    9
    String affectedClass = (String)affectedClassEnum.nextElement();
    Differences
    Expression1Expression2Difference
    keyaffectedClassVARIABLE_NAME_MISMATCH
    eaffectedClassEnumVARIABLE_NAME_MISMATCH
    9
    String affectedClass = (String)affectedClassEnum.nextElement();
    6
    Attribute attribute = getAttribute(key);
    6
    Attribute attribute = getAttribute(key);
    Preondition Violations
    Unmatched statement Attribute attribute=getAttribute(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                      
                                                                                                                                                      
    10
    ClassFileInfo info = (ClassFileInfo)affectedClasses.get(affectedClass);
    Preondition Violations
    Unmatched statement ClassFileInfo info=(ClassFileInfo)affectedClasses.get(affectedClass); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    ClassFileInfo info = (ClassFileInfo)affectedClasses.get(affectedClass);
    7
    cloned.storeAttribute(new Attribute(attribute.getName(), attribute.getValue()));
    7
    cloned.storeAttribute(new Attribute(attribute.getName(), attribute.getValue()));
    11
    log(" " + affectedClass + " in " + info.absoluteFile.getPath(), Project.MSG_DEBUG);
    Differences
    Expression1Expression2Difference
    storeAttributelogMETHOD_INVOCATION_NAME_MISMATCH
    cloned.storeAttribute(new Attribute(attribute.getName(),attribute.getValue()))log(" " + affectedClass + " in "+ info.absoluteFile.getPath(),Project.MSG_DEBUG)ARGUMENT_NUMBER_MISMATCH
    clonedMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression cloned.storeAttribute(new Attribute(attribute.getName(),attribute.getValue())) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method storeAttribute
    Expression log(" " + affectedClass + " in "+ info.absoluteFile.getPath(),Project.MSG_DEBUG) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression cloned.storeAttribute(new Attribute(attribute.getName(),attribute.getValue())) is a void method call, and thus it cannot be parameterized
    Expression log(" " + affectedClass + " in "+ info.absoluteFile.getPath(),Project.MSG_DEBUG) is a void method call, and thus it cannot be parameterized
    Expression cloned.storeAttribute(new Attribute(attribute.getName(),attribute.getValue())) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    • Inline private method storeAttribute
    Expression log(" " + affectedClass + " in "+ info.absoluteFile.getPath(),Project.MSG_DEBUG) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression cloned.storeAttribute(new Attribute(attribute.getName(),attribute.getValue())) is a void method call, and thus it cannot be parameterized
    Expression log(" " + affectedClass + " in "+ info.absoluteFile.getPath(),Project.MSG_DEBUG) is a void method call, and thus it cannot be parameterized
    11
    log("    " + affectedClass + " in " + info.absoluteFile.getPath(), Project.MSG_DEBUG);
    Precondition Violations (10)
    Row Violation
    1Unmatched statement Attribute attribute=getAttribute(key); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement ClassFileInfo info=(ClassFileInfo)affectedClasses.get(affectedClass); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Expression cloned.storeAttribute(new Attribute(attribute.getName(),attribute.getValue())) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression log(" " + affectedClass + " in "+ info.absoluteFile.getPath(),Project.MSG_DEBUG) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression cloned.storeAttribute(new Attribute(attribute.getName(),attribute.getValue())) is a void method call, and thus it cannot be parameterized
    6Expression log(" " + affectedClass + " in "+ info.absoluteFile.getPath(),Project.MSG_DEBUG) is a void method call, and thus it cannot be parameterized
    7Expression cloned.storeAttribute(new Attribute(attribute.getName(),attribute.getValue())) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression log(" " + affectedClass + " in "+ info.absoluteFile.getPath(),Project.MSG_DEBUG) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression cloned.storeAttribute(new Attribute(attribute.getName(),attribute.getValue())) is a void method call, and thus it cannot be parameterized
    10Expression log(" " + affectedClass + " in "+ info.absoluteFile.getPath(),Project.MSG_DEBUG) is a void method call, and thus it cannot be parameterized