if ( session.getEntityMode()==EntityMode.DOM4J ) { return new PersistentMapElementHolder( session, (Element) collection ); } else { return new PersistentMap( session, (java.util.Map) collection ); }
if ( session.getEntityMode()==EntityMode.DOM4J ) { return new PersistentElementHolder( session, (Element) collection ); } else { return new PersistentSortedSet( session, (java.util.SortedSet) collection ); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/MapType.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/SortedSetType.java
Method name: PersistentCollection wrap(SessionImplementor, Object) Method name: PersistentCollection wrap(SessionImplementor, Object)
Number of AST nodes: 3 Number of AST nodes: 3
1
if ( session.getEntityMode()==EntityMode.DOM4J ) {
1
if ( session.getEntityMode()==EntityMode.DOM4J ) {
2
			return new PersistentMapElementHolder( session, (Element) collection );
2
			return new PersistentElementHolder( session, (Element) collection );
3
		}
3
		}
4
		else {
4
		else {
5
			return new PersistentMap( session, (java.util.Map) collection );
5
			return new PersistentSortedSet( session, (java.util.SortedSet) collection );
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (session.getEntityMode() == EntityMode.DOM4J)
    1
    if (session.getEntityMode() == EntityMode.DOM4J)
    2
    return new PersistentMapElementHolder(session, (Element)collection);
    2
    return new PersistentMapElementHolder(session, (Element)collection);
    2
    return new PersistentElementHolder(session, (Element)collection);
    Differences
    Expression1Expression2Difference
    org.hibernate.collection.PersistentMapElementHolderorg.hibernate.collection.PersistentElementHolderSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new PersistentMapElementHolder(session,(Element)collection) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new PersistentElementHolder(session,(Element)collection) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2
    return new PersistentElementHolder(session, (Element)collection);
    else
    else
    3
    return new PersistentMap(session, (java.util.Map)collection);
    3
    return new PersistentMap(session, (java.util.Map)collection);
    3
    return new PersistentSortedSet(session, (java.util.SortedSet)collection);
    Differences
    Expression1Expression2Difference
    org.hibernate.collection.PersistentMaporg.hibernate.collection.PersistentSortedSetSUBCLASS_TYPE_MISMATCH
    MapSortedSetVARIABLE_NAME_MISMATCH
    java.util.Mapjava.util.SortedSetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression new PersistentMap(session,(java.util.Map)collection) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new PersistentSortedSet(session,(java.util.SortedSet)collection) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.util.Map does not match with type java.util.SortedSet
    • Make classes java.util.Map and java.util.SortedSet extend a common superclass
    3
    return new PersistentSortedSet(session, (java.util.SortedSet)collection);
    Precondition Violations (5)
    Row Violation
    1Expression new PersistentMapElementHolder(session,(Element)collection) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new PersistentElementHolder(session,(Element)collection) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new PersistentMap(session,(java.util.Map)collection) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new PersistentSortedSet(session,(java.util.SortedSet)collection) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type java.util.Map does not match with type java.util.SortedSet