if ( child instanceof ChildWithBidirectionalManyToMany ) { childWithManyToMany = ( ChildWithBidirectionalManyToMany ) child; if ( ( ( PersistentCollection ) childWithManyToMany.getParents() ).wasInitialized() ) { checkResult( listeners, listeners.getInitializeCollectionListener(), childWithManyToMany, index++ ); } }
if ( child instanceof ChildWithBidirectionalManyToMany ) { ChildWithBidirectionalManyToMany childWithManyToMany = ( ChildWithBidirectionalManyToMany ) child; if ( ( ( PersistentCollection ) childWithManyToMany.getParents() ).wasInitialized() ) { checkResult( listeners, listeners.getInitializeCollectionListener(), childWithManyToMany, index++ ); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/event/collection/AbstractCollectionEventTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/event/collection/AbstractCollectionEventTest.java
Method name: void testUpdateParentOneToTwoSameChildren() Method name: void testUpdateParentOneChildDiffCollectionSameChild()
Number of AST nodes: 4 Number of AST nodes: 4
1
if ( child instanceof ChildWithBidirectionalManyToMany ) {
1
if ( child instanceof ChildWithBidirectionalManyToMany ) {
2
			childWithManyToMany = ( ChildWithBidirectionalManyToMany ) child;
2
			ChildWithBidirectionalManyToMany childWithManyToMany = ( ChildWithBidirectionalManyToMany ) child;
3
			if ( ( ( PersistentCollection ) childWithManyToMany.getParents() ).wasInitialized() ) {
3
			if ( ( ( PersistentCollection ) childWithManyToMany.getParents() ).wasInitialized() ) {
4
				checkResult( listeners, listeners.getInitializeCollectionListener(), childWithManyToMany, index++ );
4
				checkResult( listeners, listeners.getInitializeCollectionListener(), childWithManyToMany, index++ );
5
			}
5
			}
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 declared in the same class
Number of node comparisons8
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    18
    if (child instanceof ChildWithBidirectionalManyToMany)
    19
    if (child instanceof ChildWithBidirectionalManyToMany)
    19
    childWithManyToMany = (ChildWithBidirectionalManyToMany)child;
    19
    childWithManyToMany = (ChildWithBidirectionalManyToMany)child;
    Preondition Violations
    Unmatched statement childWithManyToMany=(ChildWithBidirectionalManyToMany)child; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                                    
                                                                                                                                                                                                      
    20
    ChildWithBidirectionalManyToMany childWithManyToMany = (ChildWithBidirectionalManyToMany)child;
    Preondition Violations
    Unmatched statement ChildWithBidirectionalManyToMany childWithManyToMany=(ChildWithBidirectionalManyToMany)child; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    20
    ChildWithBidirectionalManyToMany childWithManyToMany = (ChildWithBidirectionalManyToMany)child;
    20
    if (((PersistentCollection)childWithManyToMany.getParents()).wasInitialized())
    21
    if (((PersistentCollection)childWithManyToMany.getParents()).wasInitialized())
    21
    checkResult(listeners, listeners.getInitializeCollectionListener(), childWithManyToMany, index++);
    22
    checkResult(listeners, listeners.getInitializeCollectionListener(), childWithManyToMany, index++);
    Precondition Violations (2)
    Row Violation
    1Unmatched statement childWithManyToMany=(ChildWithBidirectionalManyToMany)child; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement ChildWithBidirectionalManyToMany childWithManyToMany=(ChildWithBidirectionalManyToMany)child; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted