if (r.children != null) { List newChildren = new ArrayList(); newChildren.addAll(r.children); if (children != null) { newChildren.addAll(children); } children = newChildren; }
if (u.children != null) { List newChildren = new ArrayList(); newChildren.addAll(u.children); if (children != null) { newChildren.addAll(children); } children = newChildren; }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/RuntimeConfigurable.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/UnknownElement.java
Method name: void applyPreSet(RuntimeConfigurable) Method name: void applyPreSet(UnknownElement)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (r.children != null) {
1
if (u.children != null) {
2
            List newChildren = new ArrayList();
2
            List newChildren = new ArrayList();
3
            newChildren.addAll(r.children);
3
            newChildren.addAll(u.children);
4
            if (children != null) {
4
            if (children != null) {
5
                newChildren.addAll(children);
5
                newChildren.addAll(children);
6
            }
6
            }
7
            children = newChildren;
7
            children = newChildren;
8
        }
8
        }
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 different classes
Number of node comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    if (r.children != null)
    7
    if (r.children != null)
    4
    if (u.children != null)
    Differences
    Expression1Expression2Difference
    ruVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.RuntimeConfigurableorg.apache.tools.ant.UnknownElementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable r.children does not match with type java.util.List of variable u.children
    • Make classes org.apache.tools.ant.RuntimeConfigurable and org.apache.tools.ant.UnknownElement extend a common superclass
    4
    if (u.children != null)
    8
    List newChildren = new ArrayList();
    5
    List newChildren = new ArrayList();
    9
    newChildren.addAll(r.children);
    9
    newChildren.addAll(r.children);
    6
    newChildren.addAll(u.children);
    Differences
    Expression1Expression2Difference
    ruVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.RuntimeConfigurableorg.apache.tools.ant.UnknownElementVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression r.children cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression u.children cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.util.List of variable r.children does not match with type java.util.List of variable u.children
    • Make classes org.apache.tools.ant.RuntimeConfigurable and org.apache.tools.ant.UnknownElement extend a common superclass
    6
    newChildren.addAll(u.children);
    10
    if (children != null)
    7
    if (children != null)
    11
    newChildren.addAll(children);
    8
    newChildren.addAll(children);
    12
    children = newChildren;
    9
    children = newChildren;
    Precondition Violations (5)
    Row Violation
    1Type java.util.List of variable r.children does not match with type java.util.List of variable u.children
    2Expression r.children cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression u.children cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type java.util.List of variable r.children does not match with type java.util.List of variable u.children
    5The refactoring of the clones is infeasible, because classes org.apache.tools.ant.RuntimeConfigurable and org.apache.tools.ant.UnknownElement do not have a common superclass