for ( int j=0; j<values.length; j++ ) { list.add( new TypedValue( type, values[j], EntityMode.POJO ) ); }
if ( importantDates!=null) { for ( int i=0; i<importantDates.length; i++ ) { result+=(i==0 ?"":", ") + importantDates[i]; } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/InExpression.java File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/legacy/FooComponent.java
Method name: TypedValue[] getTypedValues(Criteria, CriteriaQuery) Method name: String toString()
Number of AST nodes: 2 Number of AST nodes: 3
1
if ( importantDates!=null) {
1
for ( int j=0; j<values.length; j++ ) {
2
			for ( int i=0; i<importantDates.length; i++ ) {
2
				list.add( new TypedValue( type, values[j], EntityMode.POJO ) );
3
				result+=(i==0 ?"":", ") + importantDates[i];
3
			}
4
			}
5
		}
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.2
Clones locationClones are in different classes
Number of node comparisons4
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    10
    for (int j = 0; j < values.length; j++)
    10
    for (int j = 0; j < values.length; j++)
    4
    for (int i = 0; i < importantDates.length; i++)
    Differences
    Expression1Expression2Difference
    jiVARIABLE_NAME_MISMATCH
    jiVARIABLE_NAME_MISMATCH
    valuesimportantDatesVARIABLE_NAME_MISMATCH
    java.lang.Object[]java.util.Date[]VARIABLE_TYPE_MISMATCH
    jiVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.lang.Object[] of variable values does not match with type java.util.Date[] of variable importantDates
    • Make classes java.lang.Object[] and java.util.Date[] extend a common superclass
    4
    for (int i = 0; i < importantDates.length; i++)
                                                                                                            
    5
    result += (i == 0 ? "" : ", ") + importantDates[i];
    Preondition Violations
    Unmatched statement result+=(i == 0 ? "" : ", ") + importantDates[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    result += (i == 0 ? "" : ", ") + importantDates[i];
    11
    list.add(new TypedValue(type, values[j], EntityMode.POJO));
    11
    list.add(new TypedValue(type, values[j], EntityMode.POJO));
    Preondition Violations
    Unmatched statement list.add(new TypedValue(type,values[j],EntityMode.POJO)); 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 java.lang.Object[] of variable values does not match with type java.util.Date[] of variable importantDates
    2Unmatched statement result+=(i == 0 ? "" : ", ") + importantDates[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement list.add(new TypedValue(type,values[j],EntityMode.POJO)); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted