if (preListeners.length > 0) { PreCollectionRecreateEvent preEvent = new PreCollectionRecreateEvent( getPersister(), getCollection(), ( EventSource ) getSession() ); for ( int i = 0; i < preListeners.length; i++ ) { preListeners[i].onPreRecreateCollection( preEvent ); } }
if (preListeners.length > 0) { PreCollectionUpdateEvent preEvent = new PreCollectionUpdateEvent( getPersister(), getCollection(), ( EventSource ) getSession() ); for ( int i = 0; i < preListeners.length; i++ ) { preListeners[i].onPreUpdateCollection( preEvent ); } }
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/action/CollectionUpdateAction.java
Method name: void preRecreate() Method name: void preUpdate()
Number of AST nodes: 4 Number of AST nodes: 4
1
if (preListeners.length > 0) {
1
if (preListeners.length > 0) {
2
			PreCollectionRecreateEvent preEvent = new PreCollectionRecreateEvent(
2
			PreCollectionUpdateEvent preEvent = new PreCollectionUpdateEvent(
3
					getPersister(), getCollection(), ( EventSource ) getSession() );
3
					getPersister(), getCollection(), ( EventSource ) getSession() );
4
			for ( int i = 0; i < preListeners.length; i++ ) {
4
			for ( int i = 0; i < preListeners.length; i++ ) {
5
				preListeners[i].onPreRecreateCollection( preEvent );
5
				preListeners[i].onPreUpdateCollection( preEvent );
6
			}
6
			}
7
		}
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)47.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (preListeners.length > 0)
    2
    if (preListeners.length > 0)
    2
    if (preListeners.length > 0)
    Differences
    Expression1Expression2Difference
    org.hibernate.event.PreCollectionRecreateEventListener[]org.hibernate.event.PreCollectionUpdateEventListener[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable preListeners.length does not match with type int of variable preListeners.length
    • Make classes org.hibernate.event.PreCollectionRecreateEventListener[] and org.hibernate.event.PreCollectionUpdateEventListener[] extend a common superclass
    2
    if (preListeners.length > 0)
    3
    PreCollectionRecreateEvent preEvent = new PreCollectionRecreateEvent(getPersister(), getCollection(), (EventSource)getSession());
    3
    PreCollectionRecreateEvent preEvent = new PreCollectionRecreateEvent(getPersister(), getCollection(), (EventSource)getSession());
    3
    PreCollectionUpdateEvent preEvent = new PreCollectionUpdateEvent(getPersister(), getCollection(), (EventSource)getSession());
    Differences
    Expression1Expression2Difference
    org.hibernate.event.PreCollectionRecreateEventorg.hibernate.event.PreCollectionUpdateEventSUBCLASS_TYPE_MISMATCH
    org.hibernate.event.PreCollectionRecreateEventorg.hibernate.event.PreCollectionUpdateEventSUBCLASS_TYPE_MISMATCH
    org.hibernate.event.PreCollectionRecreateEventorg.hibernate.event.PreCollectionUpdateEventSUBCLASS_TYPE_MISMATCH
    3
    PreCollectionUpdateEvent preEvent = new PreCollectionUpdateEvent(getPersister(), getCollection(), (EventSource)getSession());
    4
    for (int i = 0; i < preListeners.length; i++)
    4
    for (int i = 0; i < preListeners.length; i++)
    4
    for (int i = 0; i < preListeners.length; i++)
    Differences
    Expression1Expression2Difference
    org.hibernate.event.PreCollectionRecreateEventListener[]org.hibernate.event.PreCollectionUpdateEventListener[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable preListeners.length does not match with type int of variable preListeners.length
    • Make classes org.hibernate.event.PreCollectionRecreateEventListener[] and org.hibernate.event.PreCollectionUpdateEventListener[] extend a common superclass
    4
    for (int i = 0; i < preListeners.length; i++)
    5
    preListeners[i].onPreRecreateCollection(preEvent);
    5
    preListeners[i].onPreRecreateCollection(preEvent);
    5
    preListeners[i].onPreUpdateCollection(preEvent);
    Differences
    Expression1Expression2Difference
    org.hibernate.event.PreCollectionRecreateEventorg.hibernate.event.PreCollectionUpdateEventSUBCLASS_TYPE_MISMATCH
    onPreRecreateCollectiononPreUpdateCollectionMETHOD_INVOCATION_NAME_MISMATCH
    org.hibernate.event.PreCollectionRecreateEventListener[]org.hibernate.event.PreCollectionUpdateEventListener[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression preListeners[i].onPreRecreateCollection(preEvent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression preListeners[i].onPreUpdateCollection(preEvent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression preListeners[i].onPreRecreateCollection(preEvent) is a void method call, and thus it cannot be parameterized
    Expression preListeners[i].onPreUpdateCollection(preEvent) is a void method call, and thus it cannot be parameterized
    Type org.hibernate.event.PreCollectionRecreateEventListener[] of variable preListeners does not match with type org.hibernate.event.PreCollectionUpdateEventListener[] of variable preListeners
    • Make classes org.hibernate.event.PreCollectionRecreateEventListener[] and org.hibernate.event.PreCollectionUpdateEventListener[] extend a common superclass
    5
    preListeners[i].onPreUpdateCollection(preEvent);
    Precondition Violations (7)
    Row Violation
    1Type int of variable preListeners.length does not match with type int of variable preListeners.length
    2Type int of variable preListeners.length does not match with type int of variable preListeners.length
    3Expression preListeners[i].onPreRecreateCollection(preEvent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression preListeners[i].onPreUpdateCollection(preEvent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression preListeners[i].onPreRecreateCollection(preEvent) is a void method call, and thus it cannot be parameterized
    6Expression preListeners[i].onPreUpdateCollection(preEvent) is a void method call, and thus it cannot be parameterized
    7Type org.hibernate.event.PreCollectionRecreateEventListener[] of variable preListeners does not match with type org.hibernate.event.PreCollectionUpdateEventListener[] of variable preListeners