if ( listeners == null ) { eventListeners.setPostCollectionUpdateEventListeners( new PostCollectionUpdateEventListener[]{} ); } else { eventListeners.setPostCollectionUpdateEventListeners( ( PostCollectionUpdateEventListener[]) listeners ); }
if ( listeners == null ) { eventListeners.setInitializeCollectionEventListeners( new InitializeCollectionEventListener[]{} ); } else { eventListeners.setInitializeCollectionEventListeners( (InitializeCollectionEventListener[]) listeners ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Configuration.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cfg/Configuration.java
Method name: void setListeners(String, Object[]) Method name: void setListeners(String, Object[])
Number of AST nodes: 3 Number of AST nodes: 3
1
if ( listeners == null ) {
1
if ( listeners == null ) {
2
				eventListeners.setPostCollectionUpdateEventListeners( new Post
2
				eventListeners.setInitializeCollectionEventListeners(
3
CollectionUpdateEventListener[]{} 
3
						new InitializeCollectionEventListener[]{}
4
);
4
					);
5
			}
5
			}
6
			else {
6
			else {
7
				eventListeners.setPostCollectionUpdateEventListeners( ( Post
7
				eventListeners.setInitializeCollectionEventListeners(
8
CollectionUpdateEventListener[]) listeners 
8
						(InitializeCollectionEventListener[]) listeners
9
);
9
					);
10
			}
10
			}
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.3
Clones locationClones are in the same method
Number of node comparisons10
  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)1.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    134
    if (listeners == null)
    42
    if (listeners == null)
    135
    eventListeners.setPostCollectionUpdateEventListeners(new PostCollectionUpdateEventListener[] {});
    135
    eventListeners.setPostCollectionUpdateEventListeners(new PostCollectionUpdateEventListener[] {});
    43
    eventListeners.setInitializeCollectionEventListeners(new InitializeCollectionEventListener[] {});
    Differences
    Expression1Expression2Difference
    setPostCollectionUpdateEventListenerssetInitializeCollectionEventListenersMETHOD_INVOCATION_NAME_MISMATCH
    org.hibernate.event.PostCollectionUpdateEventListenerorg.hibernate.event.InitializeCollectionEventListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression eventListeners.setPostCollectionUpdateEventListeners(new PostCollectionUpdateEventListener[]{}) is a void method call, and thus it cannot be parameterized
    Expression eventListeners.setInitializeCollectionEventListeners(new InitializeCollectionEventListener[]{}) is a void method call, and thus it cannot be parameterized
    Type org.hibernate.event.PostCollectionUpdateEventListener of variable PostCollectionUpdateEventListener does not match with type org.hibernate.event.InitializeCollectionEventListener of variable InitializeCollectionEventListener
    • Make classes org.hibernate.event.PostCollectionUpdateEventListener and org.hibernate.event.InitializeCollectionEventListener extend a common superclass
    43
    eventListeners.setInitializeCollectionEventListeners(new InitializeCollectionEventListener[] {});
    else
    else
    136
    eventListeners.setPostCollectionUpdateEventListeners((PostCollectionUpdateEventListener[])listeners);
    136
    eventListeners.setPostCollectionUpdateEventListeners((PostCollectionUpdateEventListener[])listeners);
    44
    eventListeners.setInitializeCollectionEventListeners((InitializeCollectionEventListener[])listeners);
    Differences
    Expression1Expression2Difference
    setPostCollectionUpdateEventListenerssetInitializeCollectionEventListenersMETHOD_INVOCATION_NAME_MISMATCH
    org.hibernate.event.PostCollectionUpdateEventListenerorg.hibernate.event.InitializeCollectionEventListenerVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression eventListeners.setPostCollectionUpdateEventListeners((PostCollectionUpdateEventListener[])listeners) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression eventListeners.setInitializeCollectionEventListeners((InitializeCollectionEventListener[])listeners) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression eventListeners.setPostCollectionUpdateEventListeners((PostCollectionUpdateEventListener[])listeners) is a void method call, and thus it cannot be parameterized
    Expression eventListeners.setInitializeCollectionEventListeners((InitializeCollectionEventListener[])listeners) is a void method call, and thus it cannot be parameterized
    Type org.hibernate.event.PostCollectionUpdateEventListener of variable PostCollectionUpdateEventListener does not match with type org.hibernate.event.InitializeCollectionEventListener of variable InitializeCollectionEventListener
    • Make classes org.hibernate.event.PostCollectionUpdateEventListener and org.hibernate.event.InitializeCollectionEventListener extend a common superclass
    44
    eventListeners.setInitializeCollectionEventListeners((InitializeCollectionEventListener[])listeners);
    Precondition Violations (8)
    Row Violation
    1Expression eventListeners.setPostCollectionUpdateEventListeners(new PostCollectionUpdateEventListener[]{}) is a void method call, and thus it cannot be parameterized
    2Expression eventListeners.setInitializeCollectionEventListeners(new InitializeCollectionEventListener[]{}) is a void method call, and thus it cannot be parameterized
    3Type org.hibernate.event.PostCollectionUpdateEventListener of variable PostCollectionUpdateEventListener does not match with type org.hibernate.event.InitializeCollectionEventListener of variable InitializeCollectionEventListener
    4Expression eventListeners.setPostCollectionUpdateEventListeners((PostCollectionUpdateEventListener[])listeners) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression eventListeners.setInitializeCollectionEventListeners((InitializeCollectionEventListener[])listeners) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression eventListeners.setPostCollectionUpdateEventListeners((PostCollectionUpdateEventListener[])listeners) is a void method call, and thus it cannot be parameterized
    7Expression eventListeners.setInitializeCollectionEventListeners((InitializeCollectionEventListener[])listeners) is a void method call, and thus it cannot be parameterized
    8Type org.hibernate.event.PostCollectionUpdateEventListener of variable PostCollectionUpdateEventListener does not match with type org.hibernate.event.InitializeCollectionEventListener of variable InitializeCollectionEventListener