if ( isClearQueueEnabled() ) { queueOperation( new Clear() ); } else { initialize( true ); if ( ! bag.isEmpty() ) { bag.clear(); dirty(); } }
if ( isClearQueueEnabled() ) { queueOperation( new Clear() ); } else { initialize( true ); if ( ! map.isEmpty() ) { dirty(); map.clear(); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/PersistentBag.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/PersistentMap.java
Method name: void clear() Method name: void clear()
Number of AST nodes: 6 Number of AST nodes: 6
1
if ( isClearQueueEnabled() ) {
1
if ( isClearQueueEnabled() ) {
2
			queueOperation( new Clear() );
2
			queueOperation( new Clear() );
3
		}
3
		}
4
		else {
4
		else {
5
			initialize( true );
5
			initialize( true );
6
			if ( ! bag.isEmpty() ) {
6
			if ( ! map.isEmpty() ) {
7
				bag.clear();
7
				
8
				dirty
8
dirty();
9
();
9
				map.clear();
10
			}
10
			}
11
		}
11
		}
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)18.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (isClearQueueEnabled())
    1
    if (isClearQueueEnabled())
    2
    queueOperation(new Clear());
    2
    queueOperation(new Clear());
    2
    queueOperation(new Clear());
    Differences
    Expression1Expression2Difference
    org.hibernate.collection.PersistentBag.Clearorg.hibernate.collection.PersistentMap.ClearSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new Clear() cannot be unified with expression new Clear() , because common superclass type org.hibernate.collection.AbstractPersistentCollection.DelayedOperation cannot be passed as an argument to protected final void queueOperation(java.lang.Object)
    2
    queueOperation(new Clear());
    else
    else
    3
    initialize(true);
    3
    initialize(true);
    4
    if (!bag.isEmpty())
    4
    if (!bag.isEmpty())
    4
    if (!map.isEmpty())
    Differences
    Expression1Expression2Difference
    bagmapVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.MapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable bag does not match with type java.util.Map of variable map
    • Make classes java.util.List and java.util.Map extend a common superclass
    4
    if (!map.isEmpty())
    5
    bag.clear();
    5
    bag.clear();
    6
    map.clear();
    Differences
    Expression1Expression2Difference
    bagmapVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.MapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable bag does not match with type java.util.Map of variable map
    • Make classes java.util.List and java.util.Map extend a common superclass
    6
    map.clear();
    6
    dirty();
    5
    dirty();
    Precondition Violations (3)
    Row Violation
    1Expression new Clear() cannot be unified with expression new Clear() , because common superclass type org.hibernate.collection.AbstractPersistentCollection.DelayedOperation cannot be passed as an argument to protected final void queueOperation(java.lang.Object)
    2Type java.util.List of variable bag does not match with type java.util.Map of variable map
    3Type java.util.List of variable bag does not match with type java.util.Map of variable map