for ( int i = 0; i < persisters.length; i++ ) { if ( includeInSelect[i] ) { actualReturnTypes[j++] = TypeFactory.manyToOne( persisters[i].getEntityName(), shallowQuery ); } }
for ( int i=0; i<columnNames.length; i++ ) { if ( insertable[i] ) { addColumn( columnNames[i] ); } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/hql/classic/QueryTranslatorImpl.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/sql/Insert.java
Method name: void renderSQL() Method name: Insert addColumns(String[], boolean[])
Number of AST nodes: 3 Number of AST nodes: 3
1
for ( int i = 0; i < persisters.length; i++ ) {
1
for ( int i=0; i<columnNames.length; i++ ) {
2
				if ( includeInSelect[i] ) {
2
			if ( in
3
					actualReturnTypes[j++] = TypeFactory.manyToOne( persisters[i].getEntityName(), shallowQuery
3
sertable[i] ) {
4
 );
4
				addColumn( columnNames[i] );
5
				}
5
			}
6
			}
6
		}
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.3
Clones locationClones are in different classes
Number of node comparisons6
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    69
    for (int i = 0; i < persisters.length; i++)
    69
    for (int i = 0; i < persisters.length; i++)
    1
    for (int i = 0; i < columnNames.length; i++)
    Differences
    Expression1Expression2Difference
    persisterscolumnNamesVARIABLE_NAME_MISMATCH
    org.hibernate.persister.entity.Queryable[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.persister.entity.Queryable[] of variable persisters does not match with type java.lang.String[] of variable columnNames
    • Make classes org.hibernate.persister.entity.Queryable[] and java.lang.String[] extend a common superclass
    1
    for (int i = 0; i < columnNames.length; i++)
    70
    if (includeInSelect[i])
    70
    if (includeInSelect[i])
    2
    if (insertable[i])
    Differences
    Expression1Expression2Difference
    includeInSelectinsertableVARIABLE_NAME_MISMATCH
    2
    if (insertable[i])
                                                              
    3
    addColumn(columnNames[i]);
    Preondition Violations
    Unmatched statement addColumn(columnNames[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    addColumn(columnNames[i]);
    71
    actualReturnTypes[j++] = TypeFactory.manyToOne(persisters[i].getEntityName(), shallowQuery);
    71
    actualReturnTypes[j++] = TypeFactory.manyToOne(persisters[i].getEntityName(), shallowQuery);
    Preondition Violations
    Unmatched statement actualReturnTypes[j++]=TypeFactory.manyToOne(persisters[i].getEntityName(),shallowQuery); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                                                                                              
    Precondition Violations (3)
    Row Violation
    1Type org.hibernate.persister.entity.Queryable[] of variable persisters does not match with type java.lang.String[] of variable columnNames
    2Unmatched statement addColumn(columnNames[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement actualReturnTypes[j++]=TypeFactory.manyToOne(persisters[i].getEntityName(),shallowQuery); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted