for ( int i = 0; i < entitySpaces.length; i++ ) { if ( querySpaces.contains( entitySpaces[i] ) ) { return true; } }
for ( int i = 0; i < targetDatatypes.length; i++ ) { if ( !areSqlTypesCompatible( targetDatatypes[i], sourceDatatypes[i] ) ) { return false; } }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/action/BulkOperationCleanupAction.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/hql/ast/tree/IntoClause.java
Method name: boolean affectedEntity(Set, Serializable[]) Method name: boolean areCompatible(Type, Type)
Number of AST nodes: 3 Number of AST nodes: 3
1
for ( int i = 0; i < entitySpaces.length; i++ ) {
1
for ( int i = 0; i < targetDatatypes.length; i++ ) {
2
			if ( querySpaces.contains( entitySpaces[i] ) ) {
2
			if ( !areSqlTypesCompatible( targetDatatypes[i], sourceDatatypes[i] ) ) {
3
				return true;
3
				return false;
4
			}
4
			}
5
		}
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 comparisons5
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    for (int i = 0; i < entitySpaces.length; i++)
    3
    for (int i = 0; i < entitySpaces.length; i++)
    9
    for (int i = 0; i < targetDatatypes.length; i++)
    Differences
    Expression1Expression2Difference
    entitySpacestargetDatatypesVARIABLE_NAME_MISMATCH
    java.io.Serializable[]int[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.Serializable[] of variable entitySpaces does not match with type int[] of variable targetDatatypes
    • Make classes java.io.Serializable[] and int[] extend a common superclass
    9
    for (int i = 0; i < targetDatatypes.length; i++)
    4
    if (querySpaces.contains(entitySpaces[i]))
    4
    if (querySpaces.contains(entitySpaces[i]))
    10
    if (!areSqlTypesCompatible(targetDatatypes[i], sourceDatatypes[i]))
    Differences
    Expression1Expression2Difference
    querySpaces.contains(entitySpaces[i])!areSqlTypesCompatible(targetDatatypes[i],sourceDatatypes[i])TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression querySpaces.contains(entitySpaces[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression !areSqlTypesCompatible(targetDatatypes[i],sourceDatatypes[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10
    if (!areSqlTypesCompatible(targetDatatypes[i], sourceDatatypes[i]))
    5
    return true;
    5
    return true;
    11
    return false;
    Differences
    Expression1Expression2Difference
    truefalseLITERAL_VALUE_MISMATCH
    Preondition Violations
    Conditional return true;
    Conditional return false;
    11
    return false;
    Precondition Violations (5)
    Row Violation
    1Type java.io.Serializable[] of variable entitySpaces does not match with type int[] of variable targetDatatypes
    2Expression querySpaces.contains(entitySpaces[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression !areSqlTypesCompatible(targetDatatypes[i],sourceDatatypes[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Conditional return true;
    5Conditional return false;