Session s = openSession(); Transaction tx = s.beginTransaction(); ParentWithCollection parent = createParent( parentName ); parent.newChildren( createCollection() ); s.save( parent ); tx.commit(); s.close(); return parent;
Session s = openSession(); Transaction tx = s.beginTransaction(); ParentWithCollection parent = createParent( parentName ); parent.setChildren( createCollection() ); s.save( parent ); tx.commit(); s.close(); return parent;
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/BrokenCollectionEventTest.java
Method name: ParentWithCollection createParentWithNoChildren(String) Method name: ParentWithCollection createParentWithNoChildren(String)
Number of AST nodes: 8 Number of AST nodes: 8
1
Session s = openSession();
1
Session s = openSession();
2
		Transaction tx = s.beginTransaction();
2
		Transaction tx = s.beginTransaction();
3
		ParentWithCollection parent = createParent( parentName );
3
		ParentWithCollection parent = createParent( parentName );
4
		parent.newChildren( createCollection() );
4
		parent.setChildren( createCollection() );
5
		s.save( parent );
5
		s.save( parent );
6
		tx.commit();
6
		tx.commit();
7
		s.close();
7
		s.close();
8
		return parent;
8
		return parent;
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.0
Clones locationClones are in different classes having the same super class
Number of node comparisons28
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Session s = openSession();
    1
    Session s = openSession();
    2
    Transaction tx = s.beginTransaction();
    2
    Transaction tx = s.beginTransaction();
    3
    ParentWithCollection parent = createParent(parentName);
    3
    ParentWithCollection parent = createParent(parentName);
    4
    parent.newChildren(createCollection());
    4
    parent.newChildren(createCollection());
    4
    parent.setChildren(createCollection());
    Differences
    Expression1Expression2Difference
    newChildrensetChildrenMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression parent.newChildren(createCollection()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression parent.setChildren(createCollection()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression parent.newChildren(createCollection()) is a void method call, and thus it cannot be parameterized
    Expression parent.setChildren(createCollection()) is a void method call, and thus it cannot be parameterized
    4
    parent.setChildren(createCollection());
    5
    s.save(parent);
    5
    s.save(parent);
    6
    tx.commit();
    6
    tx.commit();
    7
    s.close();
    7
    s.close();
    8
    return parent;
    8
    return parent;
    Precondition Violations (4)
    Row Violation
    1Expression parent.newChildren(createCollection()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression parent.setChildren(createCollection()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression parent.newChildren(createCollection()) is a void method call, and thus it cannot be parameterized
    4Expression parent.setChildren(createCollection()) is a void method call, and thus it cannot be parameterized