for (Iterator i = getNested().iterator(); i.hasNext();) { if ((!((ResourceCollection) i.next()).isFilesystemOnly())) { return false; } }
for (Iterator i = cacheCollection().iterator(); i.hasNext();) { if (!(i.next() instanceof FileResource)) { return false; } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/Resources.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/BaseResourceCollectionWrapper.java
Method name: boolean isFilesystemOnly() Method name: boolean isFilesystemOnly()
Number of AST nodes: 3 Number of AST nodes: 3
1
for (Iterator i = getNested().iterator(); i.hasNext();) {
1
for (Iterator i = cacheCollection().iterator(); i.hasNext();) {
2
            if ((!((ResourceCollection) i.next()).isFilesystemOnly())) {
2
            if (!(i.next() instanceof FileResource)) {
3
                return false;
3
                return false;
4
            }
4
            }
5
        }
5
        }
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons5
  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)8.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    for (Iterator i = getNested().iterator(); i.hasNext(); )
    4
    for (Iterator i = getNested().iterator(); i.hasNext(); )
    6
    for (Iterator i = cacheCollection().iterator(); i.hasNext(); )
    Differences
    Expression1Expression2Difference
    getNestedcacheCollectionMETHOD_INVOCATION_NAME_MISMATCH
    java.util.Listjava.util.CollectionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable getNested() does not match with type java.util.Collection of variable cacheCollection()
    • Make classes java.util.List and java.util.Collection extend a common superclass
    6
    for (Iterator i = cacheCollection().iterator(); i.hasNext(); )
    5
    if ((!((ResourceCollection)i.next()).isFilesystemOnly()))
    5
    if ((!((ResourceCollection)i.next()).isFilesystemOnly()))
    7
    if (!(i.next() instanceof FileResource))
    Differences
    Expression1Expression2Difference
    (!((ResourceCollection)i.next()).isFilesystemOnly())!(i.next() instanceof FileResource)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (!((ResourceCollection)i.next()).isFilesystemOnly()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression !(i.next() instanceof FileResource) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    if (!(i.next() instanceof FileResource))
    6
    return false;
    8
    return false;
    Precondition Violations (3)
    Row Violation
    1Type java.util.List of variable getNested() does not match with type java.util.Collection of variable cacheCollection()
    2Expression (!((ResourceCollection)i.next()).isFilesystemOnly()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression !(i.next() instanceof FileResource) cannot be parameterized, because it has dependencies to/from statements that will be extracted