ForkedTestConfiguration c = new ForkedTestConfiguration(test); List l = (List) testConfigurations.get(c); if (l == null) { l = new ArrayList(); testConfigurations.put(c, l); } l.add(test);
ArrayList al = (ArrayList) nsURIByElement.get(element); if (al == null) { al = new ArrayList(); nsURIByElement.put(element, al); } al.add(uri);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/util/DOMElementWriter.java
Method name: Collection executeOrQueue(Enumeration, boolean) Method name: void addNSDefinition(Element, String)
Number of AST nodes: 6 Number of AST nodes: 5
1
ForkedTestConfiguration c =
2
                        new ForkedTestConfiguration(test);
3
                    List l = (List) testConfigurations.get(c);
1
ArrayList al = (ArrayList) 
4
            
2
nsURIByElement.get(element);
5
        if (l == null) {
3
        if (al == null) {
6
                        l = new ArrayList();
4
            al = new ArrayList();
7
                        testConfigurations.put(c, l);
5
            nsURIByElement.put(element, al);
8
                    }
6
        }
9
                    l.add(test);
7
        al.add(uri);
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 comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                  
    1
    ArrayList al = (ArrayList)nsURIByElement.get(element);
    7
    ForkedTestConfiguration c = new ForkedTestConfiguration(test);
    7
    ForkedTestConfiguration c = new ForkedTestConfiguration(test);
    Preondition Violations
    Unmatched statement ForkedTestConfiguration c=new ForkedTestConfiguration(test); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                  
    8
    List l = (List)testConfigurations.get(c);
    8
    List l = (List)testConfigurations.get(c);
    Preondition Violations
    Unmatched statement List l=(List)testConfigurations.get(c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                        
    9
    if (l == null)
    9
    if (l == null)
    2
    if (al == null)
    Differences
    Expression1Expression2Difference
    lalVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.ArrayListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable l does not match with type java.util.ArrayList of variable al
    • Make classes java.util.List and java.util.ArrayList extend a common superclass
    2
    if (al == null)
                                                
    3
    al = new ArrayList();
    Preondition Violations
    Unmatched statement al=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    al = new ArrayList();
    10
    l = new ArrayList();
    10
    l = new ArrayList();
    Preondition Violations
    Unmatched statement l=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                
    11
    testConfigurations.put(c, l);
    11
    testConfigurations.put(c, l);
    4
    nsURIByElement.put(element, al);
    Differences
    Expression1Expression2Difference
    celementVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfigurationorg.w3c.dom.ElementVARIABLE_TYPE_MISMATCH
    testConfigurationsnsURIByElementVARIABLE_NAME_MISMATCH
    java.util.Mapjava.util.HashMapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfiguration of variable c does not match with type org.w3c.dom.Element of variable element
    • Make classes org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfiguration and org.w3c.dom.Element extend a common superclass
    Type java.util.Map of variable testConfigurations does not match with type java.util.HashMap of variable nsURIByElement
    • Make classes java.util.Map and java.util.HashMap extend a common superclass
    4
    nsURIByElement.put(element, al);
    12
    l.add(test);
    12
    l.add(test);
    5
    al.add(uri);
    Differences
    Expression1Expression2Difference
    testuriVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.optional.junit.JUnitTestjava.lang.StringVARIABLE_TYPE_MISMATCH
    lalVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.ArrayListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.optional.junit.JUnitTest of variable test does not match with type java.lang.String of variable uri
    • Make classes org.apache.tools.ant.taskdefs.optional.junit.JUnitTest and java.lang.String extend a common superclass
    Type java.util.List of variable l does not match with type java.util.ArrayList of variable al
    • Make classes java.util.List and java.util.ArrayList extend a common superclass
    5
    al.add(uri);
    Precondition Violations (9)
    Row Violation
    1Unmatched statement ForkedTestConfiguration c=new ForkedTestConfiguration(test); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement List l=(List)testConfigurations.get(c); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type java.util.List of variable l does not match with type java.util.ArrayList of variable al
    4Unmatched statement al=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement l=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Type org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfiguration of variable c does not match with type org.w3c.dom.Element of variable element
    7Type java.util.Map of variable testConfigurations does not match with type java.util.HashMap of variable nsURIByElement
    8Type org.apache.tools.ant.taskdefs.optional.junit.JUnitTest of variable test does not match with type java.lang.String of variable uri
    9Type java.util.List of variable l does not match with type java.util.ArrayList of variable al