List actions = ( List ) actionBatches.get( batchNumber ); if ( actions == null ) { actions = new LinkedList(); actionBatches.put( batchNumber, actions ); } actions.add( action );
LinkedHashSet resolversForMode = ( LinkedHashSet ) entityNameResolvers.get( entityMode ); if ( resolversForMode == null ) { resolversForMode = new LinkedHashSet(); entityNameResolvers.put( entityMode, resolversForMode ); } resolversForMode.add( resolver );
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/ActionQueue.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
Method name: void addToBatch(Integer, EntityInsertAction) Method name: void registerEntityNameResolver(EntityNameResolver, EntityMode)
Number of AST nodes: 5 Number of AST nodes: 5
1
List actions = ( List ) actionBatches.get( batchNumber );
1
LinkedHashSet resolversForMode = ( LinkedHashSet ) entityNameResolvers.get( entityMode );
2
			if ( actions == null ) {
2
		if ( 
3
				actions
3
resolversForMode == null ) {
4
 = new LinkedList();
4
			resolversForMode = new LinkedHashSet();
5
				actionBatches.put( batchNumber, actions );
5
			entityNameResolvers.put( entityMode, resolversForMode );
6
			}
6
		}
7
			actions.add( action );
7
		resolversForMode.add( resolver );
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.2
Clones locationClones are in different classes
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)4.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    List actions = (List)actionBatches.get(batchNumber);
    1
    List actions = (List)actionBatches.get(batchNumber);
    1
    LinkedHashSet resolversForMode = (LinkedHashSet)entityNameResolvers.get(entityMode);
    Differences
    Expression1Expression2Difference
    java.util.Listjava.util.LinkedHashSetSUBCLASS_TYPE_MISMATCH
    actionsresolversForModeVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.LinkedHashSetSUBCLASS_TYPE_MISMATCH
    java.util.Listjava.util.LinkedHashSetSUBCLASS_TYPE_MISMATCH
    batchNumberentityModeVARIABLE_NAME_MISMATCH
    java.lang.Integerorg.hibernate.EntityModeVARIABLE_TYPE_MISMATCH
    actionBatchesentityNameResolversVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.lang.Integer of variable batchNumber does not match with type org.hibernate.EntityMode of variable entityMode
    • Make classes java.lang.Integer and org.hibernate.EntityMode extend a common superclass
    1
    LinkedHashSet resolversForMode = (LinkedHashSet)entityNameResolvers.get(entityMode);
    2
    if (actions == null)
    2
    if (actions == null)
    2
    if (resolversForMode == null)
    Differences
    Expression1Expression2Difference
    actionsresolversForModeVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.LinkedHashSetSUBCLASS_TYPE_MISMATCH
    2
    if (resolversForMode == null)
    3
    actions = new LinkedList();
    3
    actions = new LinkedList();
    3
    resolversForMode = new LinkedHashSet();
    Differences
    Expression1Expression2Difference
    actionsresolversForModeVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.LinkedHashSetSUBCLASS_TYPE_MISMATCH
    java.util.LinkedListjava.util.LinkedHashSetSUBCLASS_TYPE_MISMATCH
    3
    resolversForMode = new LinkedHashSet();
    4
    actionBatches.put(batchNumber, actions);
    4
    actionBatches.put(batchNumber, actions);
    4
    entityNameResolvers.put(entityMode, resolversForMode);
    Differences
    Expression1Expression2Difference
    batchNumberentityModeVARIABLE_NAME_MISMATCH
    java.lang.Integerorg.hibernate.EntityModeVARIABLE_TYPE_MISMATCH
    actionsresolversForModeVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.LinkedHashSetSUBCLASS_TYPE_MISMATCH
    actionBatchesentityNameResolversVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.lang.Integer of variable batchNumber does not match with type org.hibernate.EntityMode of variable entityMode
    • Make classes java.lang.Integer and org.hibernate.EntityMode extend a common superclass
    Expression actions cannot be unified with expression resolversForMode , because common superclass type java.util.Collection cannot be passed as an argument to public java.lang.Object put(java.lang.Object, java.lang.Object)
    4
    entityNameResolvers.put(entityMode, resolversForMode);
    5
    actions.add(action);
    5
    actions.add(action);
    5
    resolversForMode.add(resolver);
    Differences
    Expression1Expression2Difference
    actionresolverVARIABLE_NAME_MISMATCH
    org.hibernate.action.EntityInsertActionorg.hibernate.EntityNameResolverVARIABLE_TYPE_MISMATCH
    actionsresolversForModeVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.LinkedHashSetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.action.EntityInsertAction of variable action does not match with type org.hibernate.EntityNameResolver of variable resolver
    • Make classes org.hibernate.action.EntityInsertAction and org.hibernate.EntityNameResolver extend a common superclass
    5
    resolversForMode.add(resolver);
    Precondition Violations (4)
    Row Violation
    1Type java.lang.Integer of variable batchNumber does not match with type org.hibernate.EntityMode of variable entityMode
    2Type java.lang.Integer of variable batchNumber does not match with type org.hibernate.EntityMode of variable entityMode
    3Expression actions cannot be unified with expression resolversForMode , because common superclass type java.util.Collection cannot be passed as an argument to public java.lang.Object put(java.lang.Object, java.lang.Object)
    4Type org.hibernate.action.EntityInsertAction of variable action does not match with type org.hibernate.EntityNameResolver of variable resolver