if ( children == getChildren() ) { return; } if ( getChildren() != null ) { for ( Iterator it = getChildren().iterator(); it.hasNext(); ) { ChildWithBidirectionalManyToMany child = ( ChildWithBidirectionalManyToMany ) it.next(); child.removeParent( this ); } } if ( children != null ) { for ( Iterator it = children.iterator(); it.hasNext(); ) { ChildWithBidirectionalManyToMany child = ( ChildWithBidirectionalManyToMany ) it.next(); child.addParent( this ); } } super.newChildren( children );
if ( children == getChildren() ) { return; } if ( getChildren() != null ) { for ( Iterator it = getChildren().iterator(); it.hasNext(); ) { ChildWithManyToOne child = ( ChildWithManyToOne ) it.next(); child.setParent( null ); } } if ( children != null ) { for ( Iterator it = children.iterator(); it.hasNext(); ) { ChildWithManyToOne child = ( ChildWithManyToOne ) it.next(); child.setParent( this ); } } super.newChildren( children );
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/association/bidirectional/manytomany/ParentWithBidirectionalManyToMany.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/event/collection/association/bidirectional/onetomany/ParentWithBidirectionalOneToMany.java
Method name: void newChildren(Collection) Method name: void newChildren(Collection)
Number of AST nodes: 11 Number of AST nodes: 11
1
if ( children == getChildren() ) {
1
if ( children == getChildren() ) {
2
			return;
2
			return;
3
		}
3
		}
4
		if ( getChildren() != null ) {
4
		if ( getChildren() != null ) {
5
			for ( Iterator it = getChildren().iterator(); it.hasNext(); ) {
5
			for ( Iterator it = getChildren().iterator(); it.hasNext(); ) {
6
				ChildWithBidirectionalManyToMany child = ( ChildWithBidirectionalManyToMany ) it.next();
6
				ChildWithManyToOne child =  ( ChildWithManyToOne ) it.next();
7
				child.removeParent( this );
7
				child.setParent( null );
8
			}
8
			}
9
		}
9
		}
10
		if ( children != null ) {
10
		if ( children != null ) {
11
			for ( Iterator it = children.iterator(); it.hasNext(); ) {
11
			for ( Iterator it = children.iterator(); it.hasNext(); ) {
12
				ChildWithBidirectionalManyToMany child = ( ChildWithBidirectionalManyToMany ) it.next();
12
				ChildWithManyToOne child = ( ChildWithManyToOne ) it.next();
13
				child.addParent( this );
13
				child.setParent( this );
14
			}
14
			}
15
		}
15
		}
16
		super.newChildren( children );
16
		super.newChildren( children );
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)1.1
Clones locationClones are in different classes having the same super class
Number of node comparisons37
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)17.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (children == getChildren())
    1
    if (children == getChildren())
    2
    return;
    2
    return;
    3
    if (getChildren() != null)
    3
    if (getChildren() != null)
    4
    for (Iterator it = getChildren().iterator(); it.hasNext(); )
    4
    for (Iterator it = getChildren().iterator(); it.hasNext(); )
    5
    ChildWithBidirectionalManyToMany child = (ChildWithBidirectionalManyToMany)it.next();
    5
    ChildWithBidirectionalManyToMany child = (ChildWithBidirectionalManyToMany)it.next();
    5
    ChildWithManyToOne child = (ChildWithManyToOne)it.next();
    Differences
    Expression1Expression2Difference
    org.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManyorg.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneSUBCLASS_TYPE_MISMATCH
    org.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManyorg.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneSUBCLASS_TYPE_MISMATCH
    org.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManyorg.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (ChildWithBidirectionalManyToMany)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (ChildWithManyToOne)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    ChildWithManyToOne child = (ChildWithManyToOne)it.next();
    6
    child.removeParent(this);
    6
    child.removeParent(this);
    6
    child.setParent(null);
    Differences
    Expression1Expression2Difference
    thisnullTYPE_COMPATIBLE_REPLACEMENT
    removeParentsetParentMETHOD_INVOCATION_NAME_MISMATCH
    org.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManyorg.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression child.removeParent(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression child.setParent(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression child.removeParent(this) is a void method call, and thus it cannot be parameterized
    Expression child.setParent(null) is a void method call, and thus it cannot be parameterized
    Expression child cannot be unified with expression child , because common superclass org.hibernate.test.event.collection.ChildEntity does not declare member(s) public void removeParent(org.hibernate.test.event.collection.association.bidirectional.manytomany.ParentWithBidirectionalManyToMany) , public void setParent(org.hibernate.test.event.collection.ParentWithCollection)
    6
    child.setParent(null);
    7
    if (children != null)
    7
    if (children != null)
    8
    for (Iterator it = children.iterator(); it.hasNext(); )
    8
    for (Iterator it = children.iterator(); it.hasNext(); )
    9
    ChildWithBidirectionalManyToMany child = (ChildWithBidirectionalManyToMany)it.next();
    9
    ChildWithBidirectionalManyToMany child = (ChildWithBidirectionalManyToMany)it.next();
    9
    ChildWithManyToOne child = (ChildWithManyToOne)it.next();
    Differences
    Expression1Expression2Difference
    org.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManyorg.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneSUBCLASS_TYPE_MISMATCH
    org.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManyorg.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneSUBCLASS_TYPE_MISMATCH
    org.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManyorg.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (ChildWithBidirectionalManyToMany)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (ChildWithManyToOne)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9
    ChildWithManyToOne child = (ChildWithManyToOne)it.next();
    10
    child.addParent(this);
    10
    child.addParent(this);
    10
    child.setParent(this);
    Differences
    Expression1Expression2Difference
    addParentsetParentMETHOD_INVOCATION_NAME_MISMATCH
    org.hibernate.test.event.collection.association.bidirectional.manytomany.ChildWithBidirectionalManyToManyorg.hibernate.test.event.collection.association.bidirectional.onetomany.ChildWithManyToOneSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression child.addParent(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression child.setParent(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression child.addParent(this) is a void method call, and thus it cannot be parameterized
    Expression child.setParent(this) is a void method call, and thus it cannot be parameterized
    Expression child cannot be unified with expression child , because common superclass org.hibernate.test.event.collection.ChildEntity does not declare member(s) public void addParent(org.hibernate.test.event.collection.association.bidirectional.manytomany.ParentWithBidirectionalManyToMany) , public void setParent(org.hibernate.test.event.collection.ParentWithCollection)
    10
    child.setParent(this);
    11
    super.newChildren(children);
    11
    super.newChildren(children);
    11
    super.newChildren(children);
    Preondition Violations
    Super method call super.newChildren(children); cannot be extracted from method
    Super method call super.newChildren(children); cannot be extracted from method
    11
    super.newChildren(children);
    Precondition Violations (16)
    Row Violation
    1Expression (ChildWithBidirectionalManyToMany)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression (ChildWithManyToOne)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression child.removeParent(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression child.setParent(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression child.removeParent(this) is a void method call, and thus it cannot be parameterized
    6Expression child.setParent(null) is a void method call, and thus it cannot be parameterized
    7Expression child cannot be unified with expression child , because common superclass org.hibernate.test.event.collection.ChildEntity does not declare member(s) public void removeParent(org.hibernate.test.event.collection.association.bidirectional.manytomany.ParentWithBidirectionalManyToMany) , public void setParent(org.hibernate.test.event.collection.ParentWithCollection)
    8Expression (ChildWithBidirectionalManyToMany)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression (ChildWithManyToOne)it.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression child.addParent(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression child.setParent(this) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression child.addParent(this) is a void method call, and thus it cannot be parameterized
    13Expression child.setParent(this) is a void method call, and thus it cannot be parameterized
    14Expression child cannot be unified with expression child , because common superclass org.hibernate.test.event.collection.ChildEntity does not declare member(s) public void addParent(org.hibernate.test.event.collection.association.bidirectional.manytomany.ParentWithBidirectionalManyToMany) , public void setParent(org.hibernate.test.event.collection.ParentWithCollection)
    15Super method call super.newChildren(children); cannot be extracted from method
    16Super method call super.newChildren(children); cannot be extracted from method