File thisLink = (File) litr.next(); File parent = thisLink.getParentFile(); Vector v = (Vector) byDir.get(parent); if (v == null) { v = new Vector(); byDir.put(parent, v); } v.addElement(thisLink);
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/unix/Symlink.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/junit/JUnitTask.java
Method name: void record() Method name: Collection executeOrQueue(Enumeration, boolean)
Number of AST nodes: 7 Number of AST nodes: 6
1
File thisLink = (File) litr.next();
1
F
2
                File parent = thisLink.getParentFile();
3
                Vector v = (Vector) byDir.get(parent);
2
orkedTestConfiguration c =
3
                        new ForkedTestConfiguration(test);
4
                    List l = (List) testConfigurations.get(c);
4
                if (v == null) {
5
                    if (l == null) {
5
                    v = new Vector();
6
                        l = new ArrayList();
6
                    byDir.put(parent, v);
7
                        testConfigurations.put(c, l);
7
                }
8
                    }
8
                v.addElement(thisLink);
9
                    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 comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 3
    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);
    10
    File thisLink = (File)litr.next();
                                                                            
    11
    File parent = thisLink.getParentFile();
    11
    File parent = thisLink.getParentFile();
    Preondition Violations
    Unmatched statement File parent=thisLink.getParentFile(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                      
    12
    Vector v = (Vector)byDir.get(parent);
    12
    Vector v = (Vector)byDir.get(parent);
    Preondition Violations
    Unmatched statement Vector v=(Vector)byDir.get(parent); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                  
    13
    if (v == null)
    13
    if (v == null)
    9
    if (l == null)
    Differences
    Expression1Expression2Difference
    vlVARIABLE_NAME_MISMATCH
    java.util.Vectorjava.util.ListVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Vector of variable v does not match with type java.util.List of variable l
    • Make classes java.util.Vector 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();
    14
    v = new Vector();
    14
    v = new Vector();
    Preondition Violations
    Unmatched statement v=new Vector(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                          
    15
    byDir.put(parent, v);
    15
    byDir.put(parent, v);
    11
    testConfigurations.put(c, l);
    Differences
    Expression1Expression2Difference
    parentcVARIABLE_NAME_MISMATCH
    java.io.Fileorg.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfigurationVARIABLE_TYPE_MISMATCH
    byDirtestConfigurationsVARIABLE_NAME_MISMATCH
    java.util.Hashtablejava.util.MapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.File of variable parent does not match with type org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfiguration of variable c
    • Make classes java.io.File and org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfiguration extend a common superclass
    Type java.util.Hashtable of variable byDir 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);
                                    
    12
    l.add(test);
    16
    v.addElement(thisLink);
                                                          
    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 File parent=thisLink.getParentFile(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement Vector v=(Vector)byDir.get(parent); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Type java.util.Vector of variable v 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 v=new Vector(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Type java.io.File of variable parent does not match with type org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.ForkedTestConfiguration of variable c
    9Type java.util.Hashtable of variable byDir does not match with type java.util.Map of variable testConfigurations