if ( persister.hasCache() ) { CacheKey key = new CacheKey( entityKey.getIdentifier(), persister.getIdentifierType(), entityKey.getEntityName(), entityMode, context.getSession().getFactory() ); return persister.getCacheAccessStrategy().get( key, context.getSession().getTimestamp() ) != null; } return false;
if ( persister.hasCache() ) { CacheKey cacheKey = new CacheKey( collectionKey, persister.getKeyType(), persister.getRole(), entityMode, context.getSession().getFactory() ); return persister.getCacheAccessStrategy().get( cacheKey, context.getSession().getTimestamp() ) != null; } return false;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/BatchFetchQueue.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/BatchFetchQueue.java
Method name: boolean isCached(EntityKey, EntityPersister, EntityMode) Method name: boolean isCached(Serializable, CollectionPersister, EntityMode)
Number of AST nodes: 4 Number of AST nodes: 4
1
if ( persister.hasCache() ) {
1
if ( persister.hasCache() ) {
2
			CacheKey key = new CacheKey(
2
			CacheKey cacheKey = new CacheKey(
3
					entityKey.getIdentifier(),
3
					
4
					
4
collectionKey,
5
persister.getIdentifierType(),
5
			        persister.getKeyType(),
6
					entityKey.getEntityName(),
6
			
7
					
7
        persister.getRole(),
8
entityMode,
8
			        entityMode,
9
					context.getSession().getFactory()
9
			        context.getSession().getFactory()
10
			);
10
			);
11
			return persister.getCacheAccessStrategy().get( key, context.getSession().getTimestamp() ) != null;
11
			return persister.getCacheAccessStrategy().get( cacheKey, context.getSession().getTimestamp() ) != null;
12
		}
12
		}
13
		return false;
13
		return false;
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 declared in the same class
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)20.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (persister.hasCache())
    1
    if (persister.hasCache())
    1
    if (persister.hasCache())
    Differences
    Expression1Expression2Difference
    org.hibernate.persister.entity.EntityPersisterorg.hibernate.persister.collection.CollectionPersisterVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.persister.entity.EntityPersister of variable persister does not match with type org.hibernate.persister.collection.CollectionPersister of variable persister
    • Make classes org.hibernate.persister.entity.EntityPersister and org.hibernate.persister.collection.CollectionPersister extend a common superclass
    1
    if (persister.hasCache())
                                                                                                                                                                                                                                                                                      
    2
    CacheKey cacheKey = new CacheKey(collectionKey, persister.getKeyType(), persister.getRole(), entityMode, context.getSession().getFactory());
    Preondition Violations
    Unmatched statement CacheKey cacheKey=new CacheKey(collectionKey,persister.getKeyType(),persister.getRole(),entityMode,context.getSession().getFactory()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2
    CacheKey cacheKey = new CacheKey(collectionKey, persister.getKeyType(), persister.getRole(), entityMode, context.getSession().getFactory());
    2
    CacheKey key = new CacheKey(entityKey.getIdentifier(), persister.getIdentifierType(), entityKey.getEntityName(), entityMode, context.getSession().getFactory());
    2
    CacheKey key = new CacheKey(entityKey.getIdentifier(), persister.getIdentifierType(), entityKey.getEntityName(), entityMode, context.getSession().getFactory());
    Preondition Violations
    Unmatched statement CacheKey key=new CacheKey(entityKey.getIdentifier(),persister.getIdentifierType(),entityKey.getEntityName(),entityMode,context.getSession().getFactory()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                                                                                                                                                                                                              
    3
    return persister.getCacheAccessStrategy().get(key, context.getSession().getTimestamp()) != null;
    3
    return persister.getCacheAccessStrategy().get(key, context.getSession().getTimestamp()) != null;
    3
    return persister.getCacheAccessStrategy().get(cacheKey, context.getSession().getTimestamp()) != null;
    Differences
    Expression1Expression2Difference
    keycacheKeyVARIABLE_NAME_MISMATCH
    org.hibernate.cache.access.EntityRegionAccessStrategyorg.hibernate.cache.access.CollectionRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    org.hibernate.persister.entity.EntityPersisterorg.hibernate.persister.collection.CollectionPersisterVARIABLE_TYPE_MISMATCH
    Preondition Violations
    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.EntityRegionAccessStrategy of variable persister.getCacheAccessStrategy() does not match with type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable persister.getCacheAccessStrategy()
    • Make classes org.hibernate.cache.access.EntityRegionAccessStrategy and org.hibernate.cache.access.CollectionRegionAccessStrategy extend a common superclass
    Type org.hibernate.persister.entity.EntityPersister of variable persister does not match with type org.hibernate.persister.collection.CollectionPersister of variable persister
    • Make classes org.hibernate.persister.entity.EntityPersister and org.hibernate.persister.collection.CollectionPersister extend a common superclass
    3
    return persister.getCacheAccessStrategy().get(cacheKey, context.getSession().getTimestamp()) != null;
    4
    return false;
    4
    return false;
    Precondition Violations (7)
    Row Violation
    1Type org.hibernate.persister.entity.EntityPersister of variable persister does not match with type org.hibernate.persister.collection.CollectionPersister of variable persister
    2Unmatched statement CacheKey cacheKey=new CacheKey(collectionKey,persister.getKeyType(),persister.getRole(),entityMode,context.getSession().getFactory()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement CacheKey key=new CacheKey(entityKey.getIdentifier(),persister.getIdentifierType(),entityKey.getEntityName(),entityMode,context.getSession().getFactory()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4Expression persister.getCacheAccessStrategy() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression persister.getCacheAccessStrategy() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Type org.hibernate.cache.access.EntityRegionAccessStrategy of variable persister.getCacheAccessStrategy() does not match with type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable persister.getCacheAccessStrategy()
    7Type org.hibernate.persister.entity.EntityPersister of variable persister does not match with type org.hibernate.persister.collection.CollectionPersister of variable persister