for (int i=0; i<5; i++) { Parent p = new Parent( String.valueOf( i ) ); Child child = new Child( "child" + i ); child.setParent( p ); p.getChildren().add( child ); s.save( p ); parents.add(p); }
for (int i=0; i<5; i++) { Parent p = new Parent( String.valueOf( i + 100 ) ); Child child = new Child( "child" + i ); child.setParent( p ); p.getChildren().add( child ); s.save( p ); parents.add(p); }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/reattachment/ProxyReattachmentTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/reattachment/ProxyReattachmentTest.java
Method name: void testIterateWithClearTopOfLoop() Method name: void testIterateWithEvictTopOfLoop()
Number of AST nodes: 7 Number of AST nodes: 7
1
for (int i=0; i<5; i++) {
1
for (int i=0; i<5; i++) {
2
			Parent p = new Parent( String.valueOf( i ) );
2
			Parent p = new Parent( String.valueOf( i + 100 ) );
3
			Child child = new Child( "child" + i );
3
			Child child = new Child( "child" + i );
4
			child.setParent( p );
4
			child.setParent( p );
5
			p.getChildren().add( child );
5
			p.getChildren().add( child );
6
			s.save( p );
6
			s.save( p );
7
			parents.add(p);
7
			parents.add(p);
8
		}
8
		}
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.1
Clones locationClones are declared in the same class
Number of node comparisons49
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    for (int i = 0; i < 5; i++)
    4
    for (int i = 0; i < 5; i++)
    5
    Parent p = new Parent(String.valueOf(i));
    5
    Parent p = new Parent(String.valueOf(i));
    5
    Parent p = new Parent(String.valueOf(i + 100));
    Differences
    Expression1Expression2Difference
    ii + 100TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression i cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression i + 100 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    Parent p = new Parent(String.valueOf(i + 100));
    6
    Child child = new Child("child" + i);
    6
    Child child = new Child("child" + i);
    7
    child.setParent(p);
    7
    child.setParent(p);
    8
    p.getChildren().add(child);
    8
    p.getChildren().add(child);
    9
    s.save(p);
    9
    s.save(p);
    10
    parents.add(p);
    10
    parents.add(p);
    Precondition Violations (2)
    Row Violation
    1Expression i cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression i + 100 cannot be parameterized, because it has dependencies to/from statements that will be extracted