File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cache/impl/bridge/CollectionRegionAdapter.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/cache/impl/bridge/EntityRegionAdapter.java | |||
Method name: CollectionRegionAccessStrategy buildAccessStrategy(AccessType)
|
Method name: EntityRegionAccessStrategy buildAccessStrategy(AccessType)
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | CacheConcurrencyStrategy ccs;↵ | 1 | CacheConcurrencyStrategy ccs;↵ | |
2 | if ( AccessType.READ_ONLY.equals( accessType ) ) {↵ | 2 | if ( AccessType.READ_ONLY.equals( accessType ) ) {↵ | |
3 | if ( metadata.isMutable() ) {↵ | 3 | if ( metadata.isMutable() ) {↵ | |
4 | log.warn( "read-only cache configured for mutable collection [" + getName() + "]" );↵ | 4 | log.warn( "read-only cache configured for mutable entity [" + getName() + "]" );↵ | |
5 | }↵ | 5 | }↵ | |
6 | ccs = new ReadOnlyCache();↵ | 6 | ccs = new ReadOnlyCache();↵ | |
7 | }↵ | 7 | }↵ | |
8 | else if ( AccessType.READ_WRITE.equals( accessType ) ) {↵ | 8 | else if ( AccessType.READ_WRITE.equals( accessType ) ) {↵ | |
9 | ccs = new ReadWriteCache();↵ | 9 | ccs = new ReadWriteCache();↵ | |
10 | }↵ | 10 | }↵ | |
11 | else if ( AccessType.NONSTRICT_READ_WRITE.equals( accessType ) ) {↵ | 11 | else if ( AccessType.NONSTRICT_READ_WRITE.equals( accessType ) ) {↵ | |
12 | ccs = new NonstrictReadWriteCache();↵ | 12 | ccs = new NonstrictReadWriteCache();↵ | |
13 | }↵ | 13 | }↵ | |
14 | else if ( AccessType.TRANSACTIONAL.equals( accessType ) ) {↵ | 14 | else if ( AccessType.TRANSACTIONAL.equals( accessType ) ) {↵ | |
15 | ccs = new TransactionalCache();↵ | 15 | ccs = new TransactionalCache();↵ | |
16 | }↵ | 16 | }↵ | |
17 | else {↵ | 17 | else {↵ | |
18 | throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );↵ | 18 | throw new IllegalArgumentException( "unrecognized access strategy type [" + accessType + "]" );↵ | |
19 | }↵ | 19 | }↵ | |
20 | ccs.setCache( underlyingCache );↵ | 20 | ccs.setCache( underlyingCache );↵ | |
21 | return new CollectionAccessStrategyAdapter( this, ccs, settings ); | 21 | return new EntityAccessStrategyAdapter( this, ccs, settings ); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.1 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 49 |
Number of mapped statements | 13 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 12.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | CacheConcurrencyStrategy ccs; | 1 | CacheConcurrencyStrategy ccs; | |||||||||||
2 | if (AccessType.READ_ONLY.equals(accessType)) | 2 | if (AccessType.READ_ONLY.equals(accessType)) | |||||||||||
3 | if (metadata.isMutable()) | 3 | if (metadata.isMutable()) | |||||||||||
4 | log.warn("read-only cache configured for mutable collection [" + getName() + "]"); |
| 4 | log.warn("read-only cache configured for mutable entity [" + getName() + "]"); | ||||||||||
5 | ccs = new ReadOnlyCache(); | 5 | ccs = new ReadOnlyCache(); | |||||||||||
6 | else if (AccessType.READ_WRITE.equals(accessType)) | 6 | else if (AccessType.READ_WRITE.equals(accessType)) | |||||||||||
7 | ccs = new ReadWriteCache(); | 7 | ccs = new ReadWriteCache(); | |||||||||||
8 | else if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) | 8 | else if (AccessType.NONSTRICT_READ_WRITE.equals(accessType)) | |||||||||||
9 | ccs = new NonstrictReadWriteCache(); | 9 | ccs = new NonstrictReadWriteCache(); | |||||||||||
10 | else if (AccessType.TRANSACTIONAL.equals(accessType)) | 10 | else if (AccessType.TRANSACTIONAL.equals(accessType)) | |||||||||||
11 | ccs = new TransactionalCache(); | 11 | ccs = new TransactionalCache(); | |||||||||||
else | else | |||||||||||||
12 | throw new IllegalArgumentException("unrecognized access strategy type [" + accessType + "]"); | 12 | throw new IllegalArgumentException("unrecognized access strategy type [" + accessType + "]"); | |||||||||||
13 | ccs.setCache(underlyingCache); | 13 | ccs.setCache(underlyingCache); | |||||||||||
|
| 14 | return new EntityAccessStrategyAdapter(this, ccs, settings); | |||||||||||
14 | return new CollectionAccessStrategyAdapter(this, ccs, settings); |
| |
Row | Violation |
---|---|
1 | Unmatched statement return new EntityAccessStrategyAdapter(this,ccs,settings); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched return new EntityAccessStrategyAdapter(this,ccs,settings); |
3 | Unmatched statement return new CollectionAccessStrategyAdapter(this,ccs,settings); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched return new CollectionAccessStrategyAdapter(this,ccs,settings); |