for (Iterator i = v.iterator(); i.hasNext();) { Object o = i.next(); if (o instanceof DataType) { stk.push(o); invokeCircularReferenceCheck((DataType) o, stk, p); } }
while (e.hasMoreElements()) { Object o = e.nextElement(); if (o instanceof BaseSelector) { ((BaseSelector) o).validate(); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/selectors/ResourceSelectorContainer.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/BaseSelectorContainer.java
Method name: void dieOnCircularReference(Stack, Project) Method name: void validate()
Number of AST nodes: 5 Number of AST nodes: 4
1
for (Iterator i = v.iterator(); i.hasNext();) {
1
while (e.hasMoreElements()) {
2
                Object o = i.next();
2
            Object o = e.nextElement();
3
                if (o instanceof DataType) {
3
            if (o instanceof BaseSelector) {
4
                    stk.push(o);
4
                
5
                    invokeCircularReferenceCheck((DataType) o, stk, p);
5
((BaseSelector) o).validate();
6
                }
6
            
7
    
7
}
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.1
Clones locationClones are in different classes having the same super class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    6
    Object o = i.next();
    6
    Object o = i.next();
    Preondition Violations
    Unmatched statement Object o=i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                              
                                                            
    7
    Object o = e.nextElement();
    Preondition Violations
    Unmatched statement Object o=e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    Object o = e.nextElement();
    7
    if (o instanceof DataType)
    7
    if (o instanceof DataType)
    8
    if (o instanceof BaseSelector)
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.types.DataTypeorg.apache.tools.ant.types.selectors.BaseSelectorSUBCLASS_TYPE_MISMATCH
    8
    if (o instanceof BaseSelector)
    8
    stk.push(o);
                                  
    9
    invokeCircularReferenceCheck((DataType)o, stk, p);
    9
    invokeCircularReferenceCheck((DataType)o, stk, p);
    9
    ((BaseSelector)o).validate();
    Differences
    Expression1Expression2Difference
    invokeCircularReferenceCheckvalidateMETHOD_INVOCATION_NAME_MISMATCH
    invokeCircularReferenceCheck((DataType)o,stk,p)((BaseSelector)o).validate()ARGUMENT_NUMBER_MISMATCH
    ((BaseSelector)o)MISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression invokeCircularReferenceCheck((DataType)o,stk,p) is a void method call, and thus it cannot be parameterized
    Expression ((BaseSelector)o).validate() is a void method call, and thus it cannot be parameterized
    Expression invokeCircularReferenceCheck((DataType)o,stk,p) is a void method call, and thus it cannot be parameterized
    Expression ((BaseSelector)o).validate() is a void method call, and thus it cannot be parameterized
    9
    ((BaseSelector)o).validate();
    Precondition Violations (6)
    Row Violation
    1Unmatched statement Object o=i.next(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement Object o=e.nextElement(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Expression invokeCircularReferenceCheck((DataType)o,stk,p) is a void method call, and thus it cannot be parameterized
    4Expression ((BaseSelector)o).validate() is a void method call, and thus it cannot be parameterized
    5Expression invokeCircularReferenceCheck((DataType)o,stk,p) is a void method call, and thus it cannot be parameterized
    6Expression ((BaseSelector)o).validate() is a void method call, and thus it cannot be parameterized