if (postListeners.length > 0) { PostCollectionRecreateEvent postEvent = new PostCollectionRecreateEvent( getPersister(), getCollection(), ( EventSource ) getSession() ); for ( int i = 0; i < postListeners.length; i++ ) { postListeners[i].onPostRecreateCollection( postEvent ); } }
PostInsertEvent postEvent = new PostInsertEvent( getInstance(), getId(), state, getPersister(), (EventSource) getSession() ); for ( int i = 0; i < postListeners.length; i++ ) { postListeners[i].onPostInsert(postEvent); }
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/EntityInsertAction.java
Method name: void postRecreate() Method name: void postCommitInsert()
Number of AST nodes: 4 Number of AST nodes: 3
1
if (postListeners.length > 0) {
2
			PostCollectionRecreateEvent postEvent = new PostCollectionRecreateEvent(
1
PostInsertEvent postEvent = new Post
3
					getPersister(), getCollection(), ( 
2
InsertEvent(
3
					getInstance(),
4
					getId(),
5
					state,
6
					getPersister(),
4
EventSource ) getSession() 
7
					(EventSource) getSession() 
5
);
8
			);
6
			for ( int i = 0; i < postListeners.length; i++ ) {
9
			for ( int i = 0; i < postListeners.length; i++ ) {
7
				postListeners[i].onPostRecreateCollection( postEvent );
10
				postListeners[i].onPostInsert(postEvent);
8
			}
11
			}
9
		}
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 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)186.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    PostCollectionRecreateEvent postEvent = new PostCollectionRecreateEvent(getPersister(), getCollection(), (EventSource)getSession());
    3
    PostCollectionRecreateEvent postEvent = new PostCollectionRecreateEvent(getPersister(), getCollection(), (EventSource)getSession());
    3
    PostInsertEvent postEvent = new PostInsertEvent(getInstance(), getId(), state, getPersister(), (EventSource)getSession());
    Differences
    Expression1Expression2Difference
    org.hibernate.event.PostCollectionRecreateEventorg.hibernate.event.PostInsertEventSUBCLASS_TYPE_MISMATCH
    org.hibernate.event.PostCollectionRecreateEventorg.hibernate.event.PostInsertEventSUBCLASS_TYPE_MISMATCH
    org.hibernate.event.PostCollectionRecreateEventorg.hibernate.event.PostInsertEventSUBCLASS_TYPE_MISMATCH
    new PostCollectionRecreateEvent(getPersister(),getCollection(),(EventSource)getSession())new PostInsertEvent(getInstance(),getId(),state,getPersister(),(EventSource)getSession())ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new PostInsertEvent(getInstance(),getId(),state,getPersister(),(EventSource)getSession()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new PostInsertEvent(getInstance(),getId(),state,getPersister(),(EventSource)getSession()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    PostInsertEvent postEvent = new PostInsertEvent(getInstance(), getId(), state, getPersister(), (EventSource)getSession());
    4
    for (int i = 0; i < postListeners.length; i++)
    4
    for (int i = 0; i < postListeners.length; i++)
    4
    for (int i = 0; i < postListeners.length; i++)
    Differences
    Expression1Expression2Difference
    org.hibernate.event.PostCollectionRecreateEventListener[]org.hibernate.event.PostInsertEventListener[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable postListeners.length does not match with type int of variable postListeners.length
    • Make classes org.hibernate.event.PostCollectionRecreateEventListener[] and org.hibernate.event.PostInsertEventListener[] extend a common superclass
    4
    for (int i = 0; i < postListeners.length; i++)
    5
    postListeners[i].onPostRecreateCollection(postEvent);
    5
    postListeners[i].onPostRecreateCollection(postEvent);
    5
    postListeners[i].onPostInsert(postEvent);
    Differences
    Expression1Expression2Difference
    org.hibernate.event.PostCollectionRecreateEventorg.hibernate.event.PostInsertEventSUBCLASS_TYPE_MISMATCH
    onPostRecreateCollectiononPostInsertMETHOD_INVOCATION_NAME_MISMATCH
    org.hibernate.event.PostCollectionRecreateEventListener[]org.hibernate.event.PostInsertEventListener[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression postListeners[i].onPostRecreateCollection(postEvent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression postListeners[i].onPostInsert(postEvent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression postListeners[i].onPostRecreateCollection(postEvent) is a void method call, and thus it cannot be parameterized
    Expression postListeners[i].onPostInsert(postEvent) is a void method call, and thus it cannot be parameterized
    Type org.hibernate.event.PostCollectionRecreateEventListener[] of variable postListeners does not match with type org.hibernate.event.PostInsertEventListener[] of variable postListeners
    • Make classes org.hibernate.event.PostCollectionRecreateEventListener[] and org.hibernate.event.PostInsertEventListener[] extend a common superclass
    5
    postListeners[i].onPostInsert(postEvent);
    Precondition Violations (9)
    Row Violation
    1Expression new PostInsertEvent(getInstance(),getId(),state,getPersister(),(EventSource)getSession()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new PostInsertEvent(getInstance(),getId(),state,getPersister(),(EventSource)getSession()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type int of variable postListeners.length does not match with type int of variable postListeners.length
    4Expression postListeners[i].onPostRecreateCollection(postEvent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression postListeners[i].onPostInsert(postEvent) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression postListeners[i].onPostRecreateCollection(postEvent) is a void method call, and thus it cannot be parameterized
    7Expression postListeners[i].onPostInsert(postEvent) is a void method call, and thus it cannot be parameterized
    8Type org.hibernate.event.PostCollectionRecreateEventListener[] of variable postListeners does not match with type org.hibernate.event.PostInsertEventListener[] of variable postListeners
    9The refactoring of the clones is infeasible, because classes org.hibernate.action.CollectionRecreateAction and org.hibernate.action.EntityInsertAction do not have a common superclass