if (child instanceof TaskContainer) { // taskcontainer nested element can contain other tasks - no other // nested elements possible new TaskHandler(helperImpl, this, (TaskContainer) child, childWrapper, target).init(name, attrs); } else { new NestedElementHandler(helperImpl, this, child, childWrapper, target).init(name, attrs); }
if (task instanceof TaskContainer) { // task can contain other tasks - no other nested elements possible new TaskHandler(helperImpl, this, (TaskContainer) task, wrapper, target).init(name, attrs); } else { new NestedElementHandler(helperImpl, this, task, wrapper, target).init(name, attrs); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/helper/ProjectHelperImpl.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/helper/ProjectHelperImpl.java
Method name: void startElement(String, AttributeList) Method name: void startElement(String, AttributeList)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (child instanceof TaskContainer) {
1
if (task instanceof TaskContainer) {
2
                // taskcontainer nested element can contain other tasks - no other
2
                // task can contain other tasks - no other
3
                // nested elements possible
3
 nested elements possible
4
                new TaskHandler(helperImpl, this, (TaskContainer) child,
4
                new TaskHandler(helperImpl, this, (TaskContainer) task,
5
                    childWrapper, target).init(name, attrs);
5
                    wrapper, target).init(name, attrs);
6
            } else {
6
            } else {
7
                new NestedElementHandler(helperImpl, this, child,
7
                new NestedElementHandler(helperImpl, this, task,
8
                    childWrapper, target).init(name, attrs);
8
                    wrapper, target).init(name, attrs);
9
            }
9
            }
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.3
Clones locationClones are in the same java file
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)30.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (child instanceof TaskContainer)
    1
    if (child instanceof TaskContainer)
    1
    if (task instanceof TaskContainer)
    Differences
    Expression1Expression2Difference
    childtaskVARIABLE_NAME_MISMATCH
    java.lang.Objectorg.apache.tools.ant.TaskVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.Object of variable child does not match with type org.apache.tools.ant.Task of variable task
    • Make classes java.lang.Object and org.apache.tools.ant.Task extend a common superclass
    1
    if (task instanceof TaskContainer)
    2
    new TaskHandler(helperImpl, this, (TaskContainer)child, childWrapper, target).init(name, attrs);
    2
    new TaskHandler(helperImpl, this, (TaskContainer)child, childWrapper, target).init(name, attrs);
    2
    new TaskHandler(helperImpl, this, (TaskContainer)task, wrapper, target).init(name, attrs);
    Differences
    Expression1Expression2Difference
    childtaskVARIABLE_NAME_MISMATCH
    java.lang.Objectorg.apache.tools.ant.TaskVARIABLE_TYPE_MISMATCH
    childWrapperwrapperVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.lang.Object of variable child does not match with type org.apache.tools.ant.Task of variable task
    • Make classes java.lang.Object and org.apache.tools.ant.Task extend a common superclass
    2
    new TaskHandler(helperImpl, this, (TaskContainer)task, wrapper, target).init(name, attrs);
    else
    else
    3
    new NestedElementHandler(helperImpl, this, child, childWrapper, target).init(name, attrs);
    3
    new NestedElementHandler(helperImpl, this, child, childWrapper, target).init(name, attrs);
    3
    new NestedElementHandler(helperImpl, this, task, wrapper, target).init(name, attrs);
    Differences
    Expression1Expression2Difference
    childtaskVARIABLE_NAME_MISMATCH
    java.lang.Objectorg.apache.tools.ant.TaskVARIABLE_TYPE_MISMATCH
    childWrapperwrapperVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.lang.Object of variable child does not match with type org.apache.tools.ant.Task of variable task
    • Make classes java.lang.Object and org.apache.tools.ant.Task extend a common superclass
    3
    new NestedElementHandler(helperImpl, this, task, wrapper, target).init(name, attrs);
    Precondition Violations (3)
    Row Violation
    1Type java.lang.Object of variable child does not match with type org.apache.tools.ant.Task of variable task
    2Type java.lang.Object of variable child does not match with type org.apache.tools.ant.Task of variable task
    3Type java.lang.Object of variable child does not match with type org.apache.tools.ant.Task of variable task