if ( persister.hasCache() ) { CacheKey ck = new CacheKey( key, persister.getKeyType(), persister.getRole(), session.getEntityMode(), session.getFactory() ); persister.getCacheAccessStrategy().remove( ck ); }
if ( persister.hasCache() ) { final CacheKey ck = new CacheKey( id, persister.getIdentifierType(), persister.getRootEntityName(), source.getEntityMode(), source.getFactory() ); persister.getCacheAccessStrategy().evict( ck ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/action/CollectionAction.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/event/def/DefaultRefreshEventListener.java
Method name: void evict() Method name: void onRefresh(RefreshEvent, Map)
Number of AST nodes: 3 Number of AST nodes: 3
1
if ( persister.hasCache() ) {
1
if ( persister.hasCache() ) {
2
			CacheKey ck = new CacheKey( 
2
			final CacheKey ck = new CacheKey(
3
					key, 
3
					id,
4
					persister.getKeyType(), 
4
					persister.getIdentifierType(),
5
					persister.getRole(), 
5
					persister.getRootEntityName(),
6
					session.getEntityMode(), 
6
					source.getEntityMode(), 
7
					session.getFactory() 
7
					source.getFactory()
8
	
9
			);
8
			);
10
			persister.getCacheAccessStrategy().remove( ck );
9
			persister.getCacheAccessStrategy().evict( ck );
11
		}
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.1
Clones locationClones are in different classes
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)19.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (persister.hasCache())
    1
    if (persister.hasCache())
    32
    if (persister.hasCache())
    Differences
    Expression1Expression2Difference
    org.hibernate.persister.collection.CollectionPersisterorg.hibernate.persister.entity.EntityPersisterVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.persister.collection.CollectionPersister of variable persister does not match with type org.hibernate.persister.entity.EntityPersister of variable persister
    • Make classes org.hibernate.persister.collection.CollectionPersister and org.hibernate.persister.entity.EntityPersister extend a common superclass
    32
    if (persister.hasCache())
    2
    CacheKey ck = new CacheKey(key, persister.getKeyType(), persister.getRole(), session.getEntityMode(), session.getFactory());
    2
    CacheKey ck = new CacheKey(key, persister.getKeyType(), persister.getRole(), session.getEntityMode(), session.getFactory());
    Preondition Violations
    Unmatched statement CacheKey ck=new CacheKey(key,persister.getKeyType(),persister.getRole(),session.getEntityMode(),session.getFactory()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                
    33
    final CacheKey ck = new CacheKey(id, persister.getIdentifierType(), persister.getRootEntityName(), source.getEntityMode(), source.getFactory());
    Preondition Violations
    Unmatched statement final CacheKey ck=new CacheKey(id,persister.getIdentifierType(),persister.getRootEntityName(),source.getEntityMode(),source.getFactory()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    33
    final CacheKey ck = new CacheKey(id, persister.getIdentifierType(), persister.getRootEntityName(), source.getEntityMode(), source.getFactory());
    3
    persister.getCacheAccessStrategy().remove(ck);
    3
    persister.getCacheAccessStrategy().remove(ck);
    34
    persister.getCacheAccessStrategy().evict(ck);
    Differences
    Expression1Expression2Difference
    removeevictMETHOD_INVOCATION_NAME_MISMATCH
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    org.hibernate.persister.collection.CollectionPersisterorg.hibernate.persister.entity.EntityPersisterVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression persister.getCacheAccessStrategy().remove(ck) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression persister.getCacheAccessStrategy().evict(ck) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression persister.getCacheAccessStrategy().remove(ck) is a void method call, and thus it cannot be parameterized
    Expression persister.getCacheAccessStrategy().evict(ck) is a void method call, and thus it cannot be parameterized
    Expression persister.getCacheAccessStrategy() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression persister.getCacheAccessStrategy() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable persister.getCacheAccessStrategy() does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable persister.getCacheAccessStrategy()
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    Type org.hibernate.persister.collection.CollectionPersister of variable persister does not match with type org.hibernate.persister.entity.EntityPersister of variable persister
    • Make classes org.hibernate.persister.collection.CollectionPersister and org.hibernate.persister.entity.EntityPersister extend a common superclass
    34
    persister.getCacheAccessStrategy().evict(ck);
    Precondition Violations (11)
    Row Violation
    1Type org.hibernate.persister.collection.CollectionPersister of variable persister does not match with type org.hibernate.persister.entity.EntityPersister of variable persister
    2Unmatched statement CacheKey ck=new CacheKey(key,persister.getKeyType(),persister.getRole(),session.getEntityMode(),session.getFactory()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement final CacheKey ck=new CacheKey(id,persister.getIdentifierType(),persister.getRootEntityName(),source.getEntityMode(),source.getFactory()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Expression persister.getCacheAccessStrategy().remove(ck) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression persister.getCacheAccessStrategy().evict(ck) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression persister.getCacheAccessStrategy().remove(ck) is a void method call, and thus it cannot be parameterized
    7Expression persister.getCacheAccessStrategy().evict(ck) is a void method call, and thus it cannot be parameterized
    8Expression persister.getCacheAccessStrategy() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression persister.getCacheAccessStrategy() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable persister.getCacheAccessStrategy() does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable persister.getCacheAccessStrategy()
    11Type org.hibernate.persister.collection.CollectionPersister of variable persister does not match with type org.hibernate.persister.entity.EntityPersister of variable persister