if (key instanceof Serializable) { return cache.get( (Serializable) key ); } else { throw new CacheException("Keys must implement Serializable"); }
if (key instanceof Serializable) { cache.clear( (Serializable) key ); } else { throw new CacheException("Keys must implement Serializable"); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-swarmcache/src/main/java/org/hibernate/cache/SwarmCache.java File path: /hibernate-distribution-3.3.2.GA/project/cache-swarmcache/src/main/java/org/hibernate/cache/SwarmCache.java
Method name: Object get(Object) Method name: void remove(Object)
Number of AST nodes: 3 Number of AST nodes: 3
1
if (key instanceof Serializable) {
1
if (key instanceof Serializable) {
2
            return cache.get( (Serializable) key );
2
            cache.clear( (Serializable) key );
3
        } 
3
        } 
4
        else {
4
        else {
5
            throw new CacheException("Keys must implement Serializable");
5
            throw new CacheException("Keys must implement Serializable");
6
        }
6
        }
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 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)0.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (key instanceof Serializable)
    1
    if (key instanceof Serializable)
                                                                        
    2
    cache.clear((Serializable)key);
    Preondition Violations
    Unmatched statement cache.clear((Serializable)key); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2
    cache.clear((Serializable)key);
    2
    return cache.get((Serializable)key);
    2
    return cache.get((Serializable)key);
    Preondition Violations
    Unmatched statement return cache.get((Serializable)key); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return cache.get((Serializable)key);
                                                                                  
    else
    else
    3
    throw new CacheException("Keys must implement Serializable");
    3
    throw new CacheException("Keys must implement Serializable");
    Precondition Violations (3)
    Row Violation
    1Unmatched statement cache.clear((Serializable)key); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement return cache.get((Serializable)key); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched return cache.get((Serializable)key);