String name = (String) e.nextElement(); String className = props.getProperty(name); AntTypeDefinition def = new AntTypeDefinition(); def.setName(name); def.setClassName(className); def.setClassLoader(classLoader); antTypeTable.put(name, def);
RuntimeConfigurable childWrapper = (RuntimeConfigurable) e.nextElement(); UnknownElement childElement = new UnknownElement(childWrapper.getElementTag()); parentElement.addChild(childElement); childElement.setProject(getProject()); childElement.setRuntimeConfigurableWrapper(childWrapper); childWrapper.setProxy(childElement); replaceChildren(childWrapper, childElement);
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/ComponentHelper.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/Task.java
Method name: void initTypes() Method name: void replaceChildren(RuntimeConfigurable, UnknownElement)
Number of AST nodes: 7 Number of AST nodes: 7
1
String name = (String) e.nextElement();
2
            String className = props.getProperty(name);
3
            AntTypeDefinition def = new AntTypeDefinition();
4
            def.setName(name);
5
            def.setClassName(className);
6
            def.setClassLoader(classLoader);
7
            antTypeTable.put(name, def
1
RuntimeConfigurable childWrapper =
2
                (RuntimeConfigurable) e.nextElement();
3
            UnknownElement childElement =
4
                new UnknownElement(childWrapper.getElementTag());
5
            parentElement.addChild(childElement);
6
            childElement.setProject(getProject());
7
            childElement.setRuntimeConfigurableWrapper(childWrapper);
8
            childWrapper.setProxy(childElement);
8
);
9
            replaceChildren(childWrapper, childElement);
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.0
Clones locationClones are in different classes
Number of node comparisons45
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment6
    Number of unmapped statements in the second code fragment6
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                      
    3
    RuntimeConfigurable childWrapper = (RuntimeConfigurable)e.nextElement();
    Preondition Violations
    Unmatched statement RuntimeConfigurable childWrapper=(RuntimeConfigurable)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    RuntimeConfigurable childWrapper = (RuntimeConfigurable)e.nextElement();
                                                                                                                                                                    
    4
    UnknownElement childElement = new UnknownElement(childWrapper.getElementTag());
    Preondition Violations
    Unmatched statement UnknownElement childElement=new UnknownElement(childWrapper.getElementTag()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    UnknownElement childElement = new UnknownElement(childWrapper.getElementTag());
                                                                                    
    5
    parentElement.addChild(childElement);
    5
    String name = (String)e.nextElement();
    5
    String name = (String)e.nextElement();
    Preondition Violations
    Unmatched statement String name=(String)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                  
                                                                                      
    6
    childElement.setProject(getProject());
    6
    String className = props.getProperty(name);
                                                                                            
                                                                                                                            
    7
    childElement.setRuntimeConfigurableWrapper(childWrapper);
    7
    AntTypeDefinition def = new AntTypeDefinition();
    7
    AntTypeDefinition def = new AntTypeDefinition();
    Preondition Violations
    Unmatched statement AntTypeDefinition def=new AntTypeDefinition(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                      
                                                                                  
    8
    childWrapper.setProxy(childElement);
    8
    def.setName(name);
    8
    def.setName(name);
    9
    replaceChildren(childWrapper, childElement);
    Differences
    Expression1Expression2Difference
    setNamereplaceChildrenMETHOD_INVOCATION_NAME_MISMATCH
    def.setName(name)replaceChildren(childWrapper,childElement)ARGUMENT_NUMBER_MISMATCH
    defMISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression def.setName(name) is a void method call, and thus it cannot be parameterized
    Expression replaceChildren(childWrapper,childElement) is a void method call, and thus it cannot be parameterized
    Expression def.setName(name) is a void method call, and thus it cannot be parameterized
    Expression replaceChildren(childWrapper,childElement) is a void method call, and thus it cannot be parameterized
    9
    replaceChildren(childWrapper, childElement);
    9
    def.setClassName(className);
                                                                  
    10
    def.setClassLoader(classLoader);
                                                                            
    11
    antTypeTable.put(name, def);
                                                                  
    Precondition Violations (8)
    Row Violation
    1Unmatched statement RuntimeConfigurable childWrapper=(RuntimeConfigurable)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement UnknownElement childElement=new UnknownElement(childWrapper.getElementTag()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement String name=(String)e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement AntTypeDefinition def=new AntTypeDefinition(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Expression def.setName(name) is a void method call, and thus it cannot be parameterized
    6Expression replaceChildren(childWrapper,childElement) is a void method call, and thus it cannot be parameterized
    7Expression def.setName(name) is a void method call, and thus it cannot be parameterized
    8Expression replaceChildren(childWrapper,childElement) is a void method call, and thus it cannot be parameterized