count++; Object[] row = (Object[]) rs.next(); assertTrue( row[0] instanceof Long ); assertTrue( row[1] instanceof String ); assertTrue( row[2] instanceof Foo ); assertTrue( row[3] instanceof Foo );
count++; Object[] row = (Object[]) rs.next(); assertTrue( row[0] instanceof Long ); assertTrue( row[1] instanceof FooComponent ); assertTrue( row[2] instanceof Foo ); assertTrue( row[3] instanceof Foo );
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooBarTest.java
Method name: void testQuery() Method name: void testQuery()
Number of AST nodes: 6 Number of AST nodes: 6
1
count++;
1
count++;
2
			Object[] row = (Object[]) rs.next();
2
			Object[] row = (Object[]) rs.next();
3
			assertTrue( row[0] instanceof Long );
3
			assertTrue( row[0] instanceof Long );
4
			assertTrue( row[1] instanceof String );
4
			assertTrue( row[1] instanceof FooComponent );
5
			assertTrue( row[2] instanceof Foo );
5
			assertTrue( row[2] instanceof Foo );
6
			assertTrue( row[3] instanceof Foo );
6
			assertTrue( row[3] instanceof Foo );
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 the same method
Number of node comparisons37
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    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
    162
    count++;
    183
    count++;
    163
    Object[] row = (Object[])rs.next();
    184
    Object[] row = (Object[])rs.next();
    164
    assertTrue(row[0] instanceof Long);
    185
    assertTrue(row[0] instanceof Long);
    165
    assertTrue(row[1] instanceof String);
    165
    assertTrue(row[1] instanceof String);
    186
    assertTrue(row[1] instanceof FooComponent);
    Differences
    Expression1Expression2Difference
    java.lang.Stringorg.hibernate.test.legacy.FooComponentVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression row[1] instanceof String cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression row[1] instanceof FooComponent cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type boolean of variable row[1] instanceof String does not match with type boolean of variable row[1] instanceof FooComponent
    • Make classes java.lang.String and org.hibernate.test.legacy.FooComponent extend a common superclass
    186
    assertTrue(row[1] instanceof FooComponent);
    166
    assertTrue(row[2] instanceof Foo);
    187
    assertTrue(row[2] instanceof Foo);
    167
    assertTrue(row[3] instanceof Foo);
    188
    assertTrue(row[3] instanceof Foo);
    Precondition Violations (3)
    Row Violation
    1Expression row[1] instanceof String cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression row[1] instanceof FooComponent cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Type boolean of variable row[1] instanceof String does not match with type boolean of variable row[1] instanceof FooComponent