while (e.hasMoreElements()) { Object o = e.nextElement(); if (o instanceof BaseSelector) { ((BaseSelector) o).validate(); } }
for (Iterator i = getNested().iterator(); i.hasNext();) { Object o = i.next(); if (o instanceof DataType) { invokeCircularReferenceCheck((DataType) o, stk, p); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/selectors/BaseSelectorContainer.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/types/resources/Resources.java
Method name: void validate() Method name: void dieOnCircularReference(Stack, Project)
Number of AST nodes: 4 Number of AST nodes: 4
1
while (e.hasMoreElements()) {
1
for (Iterator i = getNested().iterator(); i.hasNext();) {
2
            Object o = e.nextElement();
2
                Object o = i.next();
3
            if (o instanceof BaseSelector) {
3
                if (o instanceof DataType) {
4
                ((BaseSelector) o).validate();
4
                    invokeCircularReferenceCheck((DataType) o, stk, p);
5
            }
5
            
6
    }
6
        }
7
            }
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 comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                              
    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
    6
    Object o = i.next();
    7
    Object o = e.nextElement();
    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
                                                            
    8
    if (o instanceof BaseSelector)
    8
    if (o instanceof BaseSelector)
    7
    if (o instanceof DataType)
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.types.selectors.BaseSelectororg.apache.tools.ant.types.DataTypeSUBCLASS_TYPE_MISMATCH
    7
    if (o instanceof DataType)
    9
    ((BaseSelector)o).validate();
    9
    ((BaseSelector)o).validate();
    8
    invokeCircularReferenceCheck((DataType)o, stk, p);
    Differences
    Expression1Expression2Difference
    validateinvokeCircularReferenceCheckMETHOD_INVOCATION_NAME_MISMATCH
    ((BaseSelector)o).validate()invokeCircularReferenceCheck((DataType)o,stk,p)ARGUMENT_NUMBER_MISMATCH
    ((BaseSelector)o)MISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    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
    Expression invokeCircularReferenceCheck((DataType)o,stk,p) is a void method call, and thus it cannot be parameterized
    8
    invokeCircularReferenceCheck((DataType)o, stk, p);
    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 ((BaseSelector)o).validate() is a void method call, and thus it cannot be parameterized
    4Expression invokeCircularReferenceCheck((DataType)o,stk,p) is a void method call, and thus it cannot be parameterized
    5Expression ((BaseSelector)o).validate() is a void method call, and thus it cannot be parameterized
    6Expression invokeCircularReferenceCheck((DataType)o,stk,p) is a void method call, and thus it cannot be parameterized