while (e.hasMoreElements()) { String sectionName = (String) e.nextElement(); Section section = getSection(sectionName); section.write(writer); }
while (e.hasMoreElements()) { String key = (String) e.nextElement(); Attribute attribute = getAttribute(key); attribute.write(writer); }
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/Manifest.java
Method name: void write(PrintWriter) Method name: void write(PrintWriter)
Number of AST nodes: 4 Number of AST nodes: 4
1
while (e.hasMoreElements()) {
1
while (e.hasMoreElements()) {
2
            String sectionName = (String) e.nextElement();
2
                String key = (String) e.nextElement();
3
            Section section = getSection(sectionName);
3
                Attribute attribute = getAttribute(key);
4
            section.write(writer);
4
                attribute.write(writer);
5
        }
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.1
Clones locationClones are in the same java file
Number of node comparisons16
  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)0.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    12
    while (e.hasMoreElements())
    5
    while (e.hasMoreElements())
    13
    String sectionName = (String)e.nextElement();
    13
    String sectionName = (String)e.nextElement();
    6
    String key = (String)e.nextElement();
    Differences
    Expression1Expression2Difference
    sectionNamekeyVARIABLE_NAME_MISMATCH
    6
    String key = (String)e.nextElement();
                                                                                      
    7
    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
    7
    Attribute attribute = getAttribute(key);
    14
    Section section = getSection(sectionName);
    14
    Section section = getSection(sectionName);
    Preondition Violations
    Unmatched statement Section section=getSection(sectionName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                            
    15
    section.write(writer);
    15
    section.write(writer);
    8
    attribute.write(writer);
    Differences
    Expression1Expression2Difference
    sectionattributeVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.Manifest.Sectionorg.apache.tools.ant.taskdefs.Manifest.AttributeVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.Manifest.Section of variable section does not match with type org.apache.tools.ant.taskdefs.Manifest.Attribute of variable attribute
    • Make classes org.apache.tools.ant.taskdefs.Manifest.Section and org.apache.tools.ant.taskdefs.Manifest.Attribute extend a common superclass
    8
    attribute.write(writer);
    Precondition Violations (3)
    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 Section section=getSection(sectionName); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.apache.tools.ant.taskdefs.Manifest.Section of variable section does not match with type org.apache.tools.ant.taskdefs.Manifest.Attribute of variable attribute