CollectionRegion region = regionFactory.buildCollectionRegion("test", properties, null); assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion()); try { region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion(); fail("Did not get READ_ONLY"); } catch (UnsupportedOperationException good) {} try { region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); fail("Incorrectly got NONSTRICT_READ_WRITE"); } catch (CacheException good) {} try { region.buildAccessStrategy(AccessType.READ_WRITE); fail("Incorrectly got READ_WRITE"); } catch (CacheException good) {}
EntityRegion region = regionFactory.buildEntityRegion("test", properties, null); assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion()); try { region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion(); fail("Did not get READ_ONLY"); } catch (UnsupportedOperationException good) {} try { region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); fail("Incorrectly got NONSTRICT_READ_WRITE"); } catch (CacheException good) {} try { region.buildAccessStrategy(AccessType.READ_WRITE); fail("Incorrectly got READ_WRITE"); } catch (CacheException good) {}
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/collection/CollectionRegionImplTestCase.java File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/test/java/org/hibernate/test/cache/jbc2/entity/EntityRegionImplTestCase.java
Method name: void supportedAccessTypeTest(RegionFactory, Properties) Method name: void supportedAccessTypeTest(RegionFactory, Properties)
Number of AST nodes: 11 Number of AST nodes: 11
1
CollectionRegion region = regionFactory.buildCollectionRegion("test", properties, null);
1
EntityRegion region = regionFactory.buildEntityRegion("test", properties, null);
2
        
2
        
3
        assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
3
        assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
4
        
4
        
5
        try
5
        try
6
        {
6
        {
7
            region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
7
            region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
8
            fail("Did not get READ_ONLY");
8
            fail("Did not get READ_ONLY");
9
        }
9
        }
10
        catch (UnsupportedOperationException good) {}
10
        catch (UnsupportedOperationException good) {}
11
        
11
        
12
        try
12
        try
13
        {
13
        {
14
            region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
14
            region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
15
            fail("Incorrectly got NONSTRICT_READ_WRITE");
15
            fail("Incorrectly got NONSTRICT_READ_WRITE");
16
        }
16
        }
17
        catch (CacheException good) {}
17
        catch (CacheException good) {}
18
        
18
        
19
        try
19
        try
20
        {
20
        {
21
            region.buildAccessStrategy(AccessType.READ_WRITE);
21
            region.buildAccessStrategy(AccessType.READ_WRITE);
22
            fail("Incorrectly got READ_WRITE");
22
            fail("Incorrectly got READ_WRITE");
23
        }
23
        }
24
        catch (CacheException good) {}
24
        catch (CacheException good) {}
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.7
Clones locationClones are in different classes having the same super class
Number of node comparisons61
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)18.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    CollectionRegion region = regionFactory.buildCollectionRegion("test", properties, null);
    1
    CollectionRegion region = regionFactory.buildCollectionRegion("test", properties, null);
    1
    EntityRegion region = regionFactory.buildEntityRegion("test", properties, null);
    Differences
    Expression1Expression2Difference
    org.hibernate.cache.CollectionRegionorg.hibernate.cache.EntityRegionSUBCLASS_TYPE_MISMATCH
    org.hibernate.cache.CollectionRegionorg.hibernate.cache.EntityRegionSUBCLASS_TYPE_MISMATCH
    buildCollectionRegionbuildEntityRegionMETHOD_INVOCATION_NAME_MISMATCH
    1
    EntityRegion region = regionFactory.buildEntityRegion("test", properties, null);
    2
    assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
    2
    assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
    2
    assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
    Differences
    Expression1Expression2Difference
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    org.hibernate.cache.CollectionRegionorg.hibernate.cache.EntityRegionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression region.buildAccessStrategy(AccessType.TRANSACTIONAL) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression region.buildAccessStrategy(AccessType.TRANSACTIONAL) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.TRANSACTIONAL) does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.TRANSACTIONAL)
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    Expression region cannot be unified with expression region , because common superclass org.hibernate.cache.TransactionalDataRegion does not declare member(s) public abstract org.hibernate.cache.access.CollectionRegionAccessStrategy buildAccessStrategy(org.hibernate.cache.access.AccessType) throws org.hibernate.cache.CacheException, public abstract org.hibernate.cache.access.EntityRegionAccessStrategy buildAccessStrategy(org.hibernate.cache.access.AccessType) throws org.hibernate.cache.CacheException
    2
    assertNull("Got TRANSACTIONAL", region.buildAccessStrategy(AccessType.TRANSACTIONAL).lockRegion());
    3
    try
    3
    try
    4
    region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
    4
    region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
    4
    region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
    Differences
    Expression1Expression2Difference
    org.hibernate.cache.access.CollectionRegionAccessStrategyorg.hibernate.cache.access.EntityRegionAccessStrategyVARIABLE_TYPE_MISMATCH
    org.hibernate.cache.CollectionRegionorg.hibernate.cache.EntityRegionSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression region.buildAccessStrategy(AccessType.READ_ONLY) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression region.buildAccessStrategy(AccessType.READ_ONLY) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.READ_ONLY) does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.READ_ONLY)
    • Make classes org.hibernate.cache.access.CollectionRegionAccessStrategy and org.hibernate.cache.access.EntityRegionAccessStrategy extend a common superclass
    Expression region cannot be unified with expression region , because common superclass org.hibernate.cache.TransactionalDataRegion does not declare member(s) public abstract org.hibernate.cache.access.CollectionRegionAccessStrategy buildAccessStrategy(org.hibernate.cache.access.AccessType) throws org.hibernate.cache.CacheException, public abstract org.hibernate.cache.access.EntityRegionAccessStrategy buildAccessStrategy(org.hibernate.cache.access.AccessType) throws org.hibernate.cache.CacheException
    4
    region.buildAccessStrategy(AccessType.READ_ONLY).lockRegion();
    5
    fail("Did not get READ_ONLY");
    5
    fail("Did not get READ_ONLY");
    6
    try
    6
    try
                                                                                                                                  
    7
    region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
    Preondition Violations
    Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    7
    region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
    7
    region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
    7
    region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE);
    Preondition Violations
    Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                                  
    8
    fail("Incorrectly got NONSTRICT_READ_WRITE");
    8
    fail("Incorrectly got NONSTRICT_READ_WRITE");
    9
    try
    9
    try
                                                                                                                
    10
    region.buildAccessStrategy(AccessType.READ_WRITE);
    Preondition Violations
    Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    10
    region.buildAccessStrategy(AccessType.READ_WRITE);
    10
    region.buildAccessStrategy(AccessType.READ_WRITE);
    10
    region.buildAccessStrategy(AccessType.READ_WRITE);
    Preondition Violations
    Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                                                
    11
    fail("Incorrectly got READ_WRITE");
    11
    fail("Incorrectly got READ_WRITE");
    Precondition Violations (17)
    Row Violation
    1Expression region.buildAccessStrategy(AccessType.TRANSACTIONAL) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression region.buildAccessStrategy(AccessType.TRANSACTIONAL) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.TRANSACTIONAL) does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.TRANSACTIONAL)
    4Expression region cannot be unified with expression region , because common superclass org.hibernate.cache.TransactionalDataRegion does not declare member(s) public abstract org.hibernate.cache.access.CollectionRegionAccessStrategy buildAccessStrategy(org.hibernate.cache.access.AccessType) throws org.hibernate.cache.CacheException, public abstract org.hibernate.cache.access.EntityRegionAccessStrategy buildAccessStrategy(org.hibernate.cache.access.AccessType) throws org.hibernate.cache.CacheException
    5Expression region.buildAccessStrategy(AccessType.READ_ONLY) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression region.buildAccessStrategy(AccessType.READ_ONLY) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Type org.hibernate.cache.access.CollectionRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.READ_ONLY) does not match with type org.hibernate.cache.access.EntityRegionAccessStrategy of variable region.buildAccessStrategy(AccessType.READ_ONLY)
    8Expression region cannot be unified with expression region , because common superclass org.hibernate.cache.TransactionalDataRegion does not declare member(s) public abstract org.hibernate.cache.access.CollectionRegionAccessStrategy buildAccessStrategy(org.hibernate.cache.access.AccessType) throws org.hibernate.cache.CacheException, public abstract org.hibernate.cache.access.EntityRegionAccessStrategy buildAccessStrategy(org.hibernate.cache.access.AccessType) throws org.hibernate.cache.CacheException
    9Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    11Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    12Unmatched statement region.buildAccessStrategy(AccessType.NONSTRICT_READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    13Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    14Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    15Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    16Unmatched statement region.buildAccessStrategy(AccessType.READ_WRITE); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    17Clone fragment #1 returns variable region with type org.hibernate.cache.CollectionRegion , while Clone fragment #2 returns variable region with type org.hibernate.cache.EntityRegion