PostCollectionRecreateEvent postEvent = new PostCollectionRecreateEvent( getPersister(), getCollection(), ( EventSource ) getSession() ); for ( int i = 0; i < postListeners.length; i++ ) { postListeners[i].onPostRecreateCollection( postEvent ); }
TypedValue[] subvalues = ( (Criterion) iter.next() ).getTypedValues(crit, criteriaQuery); for ( int i=0; i<subvalues.length; i++ ) { typedValues.add( subvalues[i] ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/action/CollectionRecreateAction.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/Junction.java
Method name: void postRecreate() Method name: TypedValue[] getTypedValues(Criteria, CriteriaQuery)
Number of AST nodes: 3 Number of AST nodes: 3
1
PostCollectionRecreateEvent postEvent = new PostCollectionRecreateEvent(
2
					getPersister(), getCollection(), ( EventSource ) getSession() );
1
TypedValue[] subvalues = ( (Criterion) iter.next() ).getTypedValues(crit, criteriaQuery);
3
			for ( int i = 0; i < postListeners.length; i++ ) {
2
			for ( int i=0; i<subvalues.length; i++ ) {
4
				postListeners[i].onPostRecreateCollection( postEvent );
3
				typedValues.add( subvalues[i] );
5
			}
4
			}
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
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    PostCollectionRecreateEvent postEvent = new PostCollectionRecreateEvent(getPersister(), getCollection(), (EventSource)getSession());
                                                                                                                                                                                                                                                                          
                                                                                                                                                                                
    4
    TypedValue[] subvalues = ((Criterion)iter.next()).getTypedValues(crit, criteriaQuery);
    Preondition Violations
    Unmatched statement TypedValue[] subvalues=((Criterion)iter.next()).getTypedValues(crit,criteriaQuery); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    TypedValue[] subvalues = ((Criterion)iter.next()).getTypedValues(crit, criteriaQuery);
    4
    for (int i = 0; i < postListeners.length; i++)
    4
    for (int i = 0; i < postListeners.length; i++)
    5
    for (int i = 0; i < subvalues.length; i++)
    Differences
    Expression1Expression2Difference
    postListenerssubvaluesVARIABLE_NAME_MISMATCH
    org.hibernate.event.PostCollectionRecreateEventListener[]org.hibernate.engine.TypedValue[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable postListeners.length does not match with type int of variable subvalues.length
    • Make classes org.hibernate.event.PostCollectionRecreateEventListener[] and org.hibernate.engine.TypedValue[] extend a common superclass
    5
    for (int i = 0; i < subvalues.length; i++)
    5
    postListeners[i].onPostRecreateCollection(postEvent);
    5
    postListeners[i].onPostRecreateCollection(postEvent);
    Preondition Violations
    Unmatched statement postListeners[i].onPostRecreateCollection(postEvent); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                    
                                                                      
    6
    typedValues.add(subvalues[i]);
    Preondition Violations
    Unmatched statement typedValues.add(subvalues[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    typedValues.add(subvalues[i]);
    Precondition Violations (5)
    Row Violation
    1Unmatched statement TypedValue[] subvalues=((Criterion)iter.next()).getTypedValues(crit,criteriaQuery); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Type int of variable postListeners.length does not match with type int of variable subvalues.length
    3Unmatched statement postListeners[i].onPostRecreateCollection(postEvent); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement typedValues.add(subvalues[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero