StringBuffer buf = new StringBuffer(); if (hasSelectors()) { buf.append("{notselect: "); buf.append(super.toString()); buf.append("}"); } return buf.toString();
executeTarget("test5"); java.io.File f = new java.io.File(getProjectDir(), "copyfile.tmp"); if (f.exists()) { f.delete(); } else { fail("Copy failed"); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/NotSelector.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/taskdefs/CopyfileTest.java
Method name: String toString() Method name: void test5()
Number of AST nodes: 6 Number of AST nodes: 5
1
StringBuffer buf = new StringBuffer(
1
executeTarget("test5");
2
);
2
        java.io.File f = new java.io.File(getProjectDir(), "copyfile.tmp");
3
        if (hasSelectors()) {
3
        if (f.exists()) {
4
            buf.append("{notselect: ");
4
            
5
            buf.append(super.toString());
6
            buf.append("}");
7
        }
8
        return buf.toString();
5
f.delete();
6
        } else {
7
            fail("Copy failed");
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.1
Clones locationClones are in different classes
Number of node comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment4
    Time elapsed for statement mapping (ms)0.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                        
    1
    executeTarget("test5");
    1
    StringBuffer buf = new StringBuffer();
                                                                                  
                                                                                                                                          
    2
    java.io.File f = new java.io.File(getProjectDir(), "copyfile.tmp");
    2
    if (hasSelectors())
    2
    if (hasSelectors())
    3
    if (f.exists())
    Differences
    Expression1Expression2Difference
    hasSelectorsexistsMETHOD_INVOCATION_NAME_MISMATCH
    fMISSING_METHOD_INVOCATION_EXPRESSION
    3
    if (f.exists())
    3
    buf.append("{notselect: ");
                                                                
                                
    4
    f.delete();
    Preondition Violations
    Unmatched statement f.delete(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    f.delete();
    4
    buf.append(super.toString());
                                                                    
            
    else
                                                  
    5
    fail("Copy failed");
    5
    buf.append("}");
                                          
    6
    return buf.toString();
    6
    return buf.toString();
    Preondition Violations
    Unmatched return buf.toString();
                                                      
    Precondition Violations (2)
    Row Violation
    1Unmatched statement f.delete(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched return buf.toString();