if ( collectionPersisters != null ) { for ( int i=0; i<collectionPersisters.length; i++ ) { if ( collectionPersisters[i].isArray() ) { //for arrays, we should end the collection load before resolving //the entities, since the actual array instances are not instantiated //during loading //TODO: or we could do this polymorphically, and have two // different operations implemented differently for arrays endCollectionLoad( resultSetId, session, collectionPersisters[i] ); } } }
if ( collectionPersisters != null ) { for ( int i=0; i<collectionPersisters.length; i++ ) { if ( !collectionPersisters[i].isArray() ) { //for sets, we should end the collection load after resolving //the entities, since we might call hashCode() on the elements //TODO: or we could do this polymorphically, and have two // different operations implemented differently for arrays endCollectionLoad( resultSetId, session, collectionPersisters[i] ); } } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/loader/Loader.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/loader/Loader.java
Method name: void initializeEntitiesAndCollections(List, Object, SessionImplementor, boolean) Method name: void initializeEntitiesAndCollections(List, Object, SessionImplementor, boolean)
Number of AST nodes: 4 Number of AST nodes: 4
1
if ( collectionPersisters != null ) {
1
if ( collectionPersisters != null ) {
2
			for ( int i=0; i<collectionPersisters.length; i++ ) {
2
			for ( int i=0; i<collectionPersisters.length; i++ ) {
3
				if ( collectionPersisters[i].isArray() ) {
3
				if ( !collectionPersisters[i].isArray() ) {
4
					//for arrays, we should end the collection load before resolving
4
					//for sets, we should end the collection load after resolving
5
					//the entities, since the actual array instances are not instantiated
5
					//the entities, since 
6
					//during loading
6
we might call hashCode() on the elements
7
					//TODO: or we could do this polymorphically, and have two
7
					//TODO: or we could do this polymorphically, and have two
8
					//      different operations implemented differently for arrays
8
					//      different operations implemented differently for arrays
9
					endCollectionLoad( resultSetId, session, collectionPersisters[i] );
9
					endCollectionLoad( resultSetId, session, collectionPersisters[i] );
10
				}
10
				}
11
			}
11
			}
12
		}
12
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in the same method
Number of node comparisons7
  1. {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)3.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (collectionPersisters != null)
    19
    if (collectionPersisters != null)
    3
    for (int i = 0; i < collectionPersisters.length; i++)
    20
    for (int i = 0; i < collectionPersisters.length; i++)
    4
    if (collectionPersisters[i].isArray())
    4
    if (collectionPersisters[i].isArray())
    21
    if (!collectionPersisters[i].isArray())
    Differences
    Expression1Expression2Difference
    collectionPersisters[i].isArray()!collectionPersisters[i].isArray()TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression collectionPersisters[i].isArray() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression !collectionPersisters[i].isArray() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21
    if (!collectionPersisters[i].isArray())
    5
    endCollectionLoad(resultSetId, session, collectionPersisters[i]);
    22
    endCollectionLoad(resultSetId, session, collectionPersisters[i]);
    Precondition Violations (2)
    Row Violation
    1Expression collectionPersisters[i].isArray() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression !collectionPersisters[i].isArray() cannot be parameterized, because it has dependencies to/from statements that will be extracted