if (isReference()) { throw noChildrenAllowed(); } PathElement pe = new PathElement(); add(pe); return pe;
if (isReference()) { throw noChildrenAllowed(); } Path result = new Path(getProject()); add(result); return result;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/Path.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/PathConvert.java
Method name: PathElement createPathElement() Method name: Path createPath()
Number of AST nodes: 5 Number of AST nodes: 5
1
if (isReference()) {
1
if (isReference()) {
2
            throw noChildrenAllowed();
2
            throw noChildrenAllowed();
3
        }
3
        }
4
        PathElement pe = new PathElement();
4
        Path result = new Path(getProject());
5
        add(pe);
5
        add(result);
6
        return pe;
6
        return result;
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 comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (isReference())
    1
    if (isReference())
    2
    throw noChildrenAllowed();
    2
    throw noChildrenAllowed();
                                                                                
    3
    Path result = new Path(getProject());
    3
    PathElement pe = new PathElement();
                                                                            
    4
    add(pe);
    4
    add(pe);
    4
    add(result);
    Differences
    Expression1Expression2Difference
    peresultVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.types.Path.PathElementorg.apache.tools.ant.types.PathVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.types.Path.PathElement of variable pe does not match with type org.apache.tools.ant.types.Path of variable result
    • Make classes org.apache.tools.ant.types.Path.PathElement and org.apache.tools.ant.types.Path extend a common superclass
    4
    add(result);
                                      
    5
    return result;
    Preondition Violations
    Unmatched return result;
    5
    return result;
    5
    return pe;
    5
    return pe;
    Preondition Violations
    Unmatched return pe;
                              
    Precondition Violations (3)
    Row Violation
    1Type org.apache.tools.ant.types.Path.PathElement of variable pe does not match with type org.apache.tools.ant.types.Path of variable result
    2Unmatched return result;
    3Unmatched return pe;