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.2
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)14.0
    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());
                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                                                                                
    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) 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
    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 (5)
    Row Violation
    1Type org.hibernate.persister.collection.CollectionPersister of variable persister does not match with type org.hibernate.persister.entity.EntityPersister of variable persister
    2Expression persister.getCacheAccessStrategy().remove(ck) is a void method call, and thus it cannot be parameterized
    3Expression persister.getCacheAccessStrategy().evict(ck) is a void method call, and thus it cannot be parameterized
    4Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable persister.getCacheAccessStrategy() does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable persister.getCacheAccessStrategy()
    5Type org.hibernate.persister.collection.CollectionPersister of variable persister does not match with type org.hibernate.persister.entity.EntityPersister of variable persister