while (depEnum.hasMoreElements()) { String dependentClass = (String) depEnum.nextElement(); Hashtable affectedClasses = (Hashtable) affectedClassMap.get(dependentClass); if (affectedClasses == null) { affectedClasses = new Hashtable(); affectedClassMap.put(dependentClass, affectedClasses); } affectedClasses.put(info.className, info); }
ForkedTestConfiguration c = new ForkedTestConfiguration(test); List l = (List) testConfigurations.get(c); if (l == null) { l = new ArrayList(); testConfigurations.put(c, l); } l.add(test);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/depend/Depend.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
Method name: void determineDependencies() Method name: Collection executeOrQueue(Enumeration, boolean)
Number of AST nodes: 7 Number of AST nodes: 6
1
while (depEnum.hasMoreElements()) {
2
                String dependentClass = (String) depEnum.nextElement(
1
ForkedTestConfiguration c =
3
);
2
                        new ForkedTestConfiguration(test);
4
                Hashtable affectedClasses
3
                
5
                    = (Hashtable) affectedClassMap.get(dependentClass);
4
    List l = (List) testConfigurations.get(c);
6
                if (affectedClasses == null) {
5
                    if (l == null) {
7
                    affectedClasses = new Hashtable();
6
                    
8
                    affectedClassMap.put(dependentClass, affectedClasses
7
    l = new ArrayList();
9
);
8
                        testConfigurations.put(c, l);
10
                }
9
                
10
    }
11
                affectedClasses.put(info.className, info);
11
                  
12
            }
12
  l.add(test);
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 having the same super class
Number of node comparisons19
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                  
    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
    7
    ForkedTestConfiguration c = new ForkedTestConfiguration(test);
                                                                                        
    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
    8
    List l = (List)testConfigurations.get(c);
                                    
    12
    l.add(test);
    36
    String dependentClass = (String)depEnum.nextElement();
    36
    String dependentClass = (String)depEnum.nextElement();
    Preondition Violations
    Unmatched statement String dependentClass=(String)depEnum.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                    
    37
    Hashtable affectedClasses = (Hashtable)affectedClassMap.get(dependentClass);
    37
    Hashtable affectedClasses = (Hashtable)affectedClassMap.get(dependentClass);
    Preondition Violations
    Unmatched statement Hashtable affectedClasses=(Hashtable)affectedClassMap.get(dependentClass); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                
    38
    if (affectedClasses == null)
    38
    if (affectedClasses == null)
    9
    if (l == null)
    Differences
    Expression1Expression2Difference
    affectedClasseslVARIABLE_NAME_MISMATCH
    java.util.Hashtablejava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Hashtable of variable affectedClasses does not match with type java.util.List of variable l
    • Make classes java.util.Hashtable and java.util.List extend a common superclass
    9
    if (l == null)
                                                
    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
    10
    l = new ArrayList();
    39
    affectedClasses = new Hashtable();
    39
    affectedClasses = new Hashtable();
    Preondition Violations
    Unmatched statement affectedClasses=new Hashtable(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                            
    40
    affectedClassMap.put(dependentClass, affectedClasses);
    40
    affectedClassMap.put(dependentClass, affectedClasses);
    11
    testConfigurations.put(c, l);
    Differences
    Expression1Expression2Difference
    dependentClasscVARIABLE_NAME_MISMATCH
    java.lang.Stringorg.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfigurationVARIABLE_TYPE_MISMATCH
    affectedClassMaptestConfigurationsVARIABLE_NAME_MISMATCH
    java.util.Hashtablejava.util.MapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable dependentClass does not match with type org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfiguration of variable c
    • Make classes java.lang.String and org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfiguration extend a common superclass
    Type java.util.Hashtable of variable affectedClassMap does not match with type java.util.Map of variable testConfigurations
    • Make classes java.util.Hashtable and java.util.Map extend a common superclass
    11
    testConfigurations.put(c, l);
    41
    affectedClasses.put(info.className, info);
                                                                                              
    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
    3Unmatched statement String dependentClass=(String)depEnum.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement Hashtable affectedClasses=(Hashtable)affectedClassMap.get(dependentClass); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Type java.util.Hashtable of variable affectedClasses does not match with type java.util.List of variable l
    6Unmatched statement l=new ArrayList(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement affectedClasses=new Hashtable(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Type java.lang.String of variable dependentClass does not match with type org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfiguration of variable c
    9Type java.util.Hashtable of variable affectedClassMap does not match with type java.util.Map of variable testConfigurations