while ( rs.hasNext() ) { 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 ); }
while ( rs.hasNext() ) { count++; Object[] row = (Object[]) rs.next(); assertTrue( row[0] instanceof Double ); assertTrue( row[1] instanceof String ); assertTrue( row[2] instanceof Long ); }
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: 7 Number of AST nodes: 6
1
while ( rs.hasNext() ) {
1
while ( rs.hasNext() ) {
2
			count++;
2
			count++;
3
			Object[] row = (Object[]) rs.next();
3
			Object[] row = (Object[]) rs.next();
4
			assertTrue( row[0] instanceof Long );
4
			assertTrue( row[0] instanceof Double );
5
			assertTrue( row[1] instanceof String );
5
			assertTrue( row[1] instanceof String );
6
			assertTrue( row[2] instanceof Foo );
6
			assertTrue( row[2] instanceof 
7
			assertTrue( row[3] instanceof Foo );
7
Long );
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 in the same method
Number of node comparisons42
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.3
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    161
    while (rs.hasNext())
    172
    while (rs.hasNext())
    162
    count++;
    173
    count++;
    163
    Object[] row = (Object[])rs.next();
    174
    Object[] row = (Object[])rs.next();
    164
    assertTrue(row[0] instanceof Long);
    164
    assertTrue(row[0] instanceof Long);
    175
    assertTrue(row[0] instanceof Double);
    Differences
    Expression1Expression2Difference
    java.lang.Longjava.lang.DoubleSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression row[0] instanceof Long cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression row[0] instanceof Double cannot be parameterized, because it has dependencies to/from statements that will be extracted
    175
    assertTrue(row[0] instanceof Double);
    165
    assertTrue(row[1] instanceof String);
    176
    assertTrue(row[1] instanceof String);
    166
    assertTrue(row[2] instanceof Foo);
    166
    assertTrue(row[2] instanceof Foo);
    177
    assertTrue(row[2] instanceof Long);
    Differences
    Expression1Expression2Difference
    org.hibernate.test.legacy.Foojava.lang.LongVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression row[2] instanceof Foo cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression row[2] instanceof Long cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type boolean of variable row[2] instanceof Foo does not match with type boolean of variable row[2] instanceof Long
    • Make classes org.hibernate.test.legacy.Foo and java.lang.Long extend a common superclass
    177
    assertTrue(row[2] instanceof Long);
    167
    assertTrue(row[3] instanceof Foo);
    167
    assertTrue(row[3] instanceof Foo);
    Preondition Violations
    Unmatched statement assertTrue(row[3] instanceof Foo); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                  
    Precondition Violations (7)
    Row Violation
    1Expression row[0] instanceof Long cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression row[0] instanceof Double cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression row[2] instanceof Foo cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression row[2] instanceof Long cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type boolean of variable row[2] instanceof Foo does not match with type boolean of variable row[2] instanceof Long
    6Unmatched statement assertTrue(row[3] instanceof Foo); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Clone fragment #1 returns variables row, count , while Clone fragment #2 returns variables count