this.nodeName = mappingInfo.getNodeName(); isInstanceNodeNames.add( nodeName ); if ( mappingInfo.hasSubclasses() ) { Iterator itr = mappingInfo.getSubclassClosureIterator(); while ( itr.hasNext() ) { final PersistentClass subclassInfo = ( PersistentClass ) itr.next(); isInstanceNodeNames.add( subclassInfo.getNodeName() ); } }
this.entityName = mappingInfo.getEntityName(); isInstanceEntityNames.add( entityName ); if ( mappingInfo.hasSubclasses() ) { Iterator itr = mappingInfo.getSubclassClosureIterator(); while ( itr.hasNext() ) { final PersistentClass subclassInfo = ( PersistentClass ) itr.next(); isInstanceEntityNames.add( subclassInfo.getEntityName() ); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/tuple/Dom4jInstantiator.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/tuple/DynamicMapInstantiator.java
Method name: void Dom4jInstantiator(PersistentClass) Method name: void DynamicMapInstantiator(PersistentClass)
Number of AST nodes: 7 Number of AST nodes: 7
1
this.nodeName = mappingInfo.getNodeName();
1
this.entityName = mappingInfo.getEntityName();
2
		isInstanceNodeNames.add( nodeName );
2
		isInstanceEntityNames.add( entityName );
3
		if ( mappingInfo.hasSubclasses() ) {
3
		if ( mappingInfo.hasSubclasses() ) {
4
			Iterator itr = mappingInfo.getSubclassClosureIterator();
4
			Iterator itr = mappingInfo.getSubclassClosureIterator();
5
			while ( itr.hasNext() ) {
5
			while ( itr.hasNext() ) {
6
				final PersistentClass subclassInfo = ( PersistentClass ) itr.next();
6
				final PersistentClass subclassInfo = ( PersistentClass ) itr.next();
7
				isInstanceNodeNames.add( subclassInfo.getNodeName() );
7
				isInstanceEntityNames.add( subclassInfo.getEntityName() );
8
			}
8
			}
9
		}
9
		}
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 comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    this.nodeName = mappingInfo.getNodeName();
    1
    this.nodeName = mappingInfo.getNodeName();
    1
    this.entityName = mappingInfo.getEntityName();
    Differences
    Expression1Expression2Difference
    nodeNameentityNameVARIABLE_NAME_MISMATCH
    getNodeNamegetEntityNameMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression this.nodeName is a field being modified, and thus it cannot be parameterized
    Expression this.entityName is a field being modified, and thus it cannot be parameterized
    1
    this.entityName = mappingInfo.getEntityName();
    2
    isInstanceNodeNames.add(nodeName);
    2
    isInstanceNodeNames.add(nodeName);
    2
    isInstanceEntityNames.add(entityName);
    Differences
    Expression1Expression2Difference
    nodeNameentityNameVARIABLE_NAME_MISMATCH
    isInstanceNodeNamesisInstanceEntityNamesVARIABLE_NAME_MISMATCH
    java.util.HashSetjava.util.SetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression nodeName cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression entityName cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.util.HashSet of variable isInstanceNodeNames does not match with type java.util.Set of variable isInstanceEntityNames
    • Make classes java.util.HashSet and java.util.Set extend a common superclass
    2
    isInstanceEntityNames.add(entityName);
    3
    if (mappingInfo.hasSubclasses())
    3
    if (mappingInfo.hasSubclasses())
    4
    Iterator itr = mappingInfo.getSubclassClosureIterator();
    4
    Iterator itr = mappingInfo.getSubclassClosureIterator();
    5
    while (itr.hasNext())
    5
    while (itr.hasNext())
    6
    final PersistentClass subclassInfo = (PersistentClass)itr.next();
    6
    final PersistentClass subclassInfo = (PersistentClass)itr.next();
                                                                                                                          
    7
    isInstanceEntityNames.add(subclassInfo.getEntityName());
    Preondition Violations
    Unmatched statement isInstanceEntityNames.add(subclassInfo.getEntityName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7
    isInstanceEntityNames.add(subclassInfo.getEntityName());
    7
    isInstanceNodeNames.add(subclassInfo.getNodeName());
    7
    isInstanceNodeNames.add(subclassInfo.getNodeName());
    Preondition Violations
    Unmatched statement isInstanceNodeNames.add(subclassInfo.getNodeName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                  
    Precondition Violations (7)
    Row Violation
    1Expression this.nodeName is a field being modified, and thus it cannot be parameterized
    2Expression this.entityName is a field being modified, and thus it cannot be parameterized
    3Expression nodeName cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression entityName cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type java.util.HashSet of variable isInstanceNodeNames does not match with type java.util.Set of variable isInstanceEntityNames
    6Unmatched statement isInstanceEntityNames.add(subclassInfo.getEntityName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement isInstanceNodeNames.add(subclassInfo.getNodeName()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted