String[] aliases = new String[ sqlIdentifiers.length ]; for ( int i=0; i<sqlIdentifiers.length; i++ ) { aliases[i] = toAliasString(sqlIdentifiers[i]); } return aliases;
int length=objects.length; String[] result = new String[length]; for (int i=0; i<length; i++) { result[i] = objects[i].toString(); } return result;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/sql/Alias.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/ArrayHelper.java
Method name: String[] toAliasStrings(String[]) Method name: String[] toStringArray(Object[])
Number of AST nodes: 4 Number of AST nodes: 5
1
int length=objects.length;
1
String[] aliases = new String[ sqlIdentifiers.length ];
2
		String[] result = new String[length];
2
		for ( int i=0; i<sqlIdentifiers.length; i++ ) {
3
		for (int i=0; i<length; i++) {
3
			aliases[i] = toAliasString(sqlIdentifiers[i]);
4
			result[i] = objects[i].toString();
4
		}
5
		}
5
		return aliases;
6
		return result;
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 different classes
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.9
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                              
    1
    int length = objects.length;
    1
    String[] aliases = new String[sqlIdentifiers.length];
    1
    String[] aliases = new String[sqlIdentifiers.length];
    2
    String[] result = new String[length];
    Differences
    Expression1Expression2Difference
    aliasesresultVARIABLE_NAME_MISMATCH
    sqlIdentifiers.lengthlengthTYPE_COMPATIBLE_REPLACEMENT
    2
    String[] result = new String[length];
    2
    for (int i = 0; i < sqlIdentifiers.length; i++)
    2
    for (int i = 0; i < sqlIdentifiers.length; i++)
    3
    for (int i = 0; i < length; i++)
    Differences
    Expression1Expression2Difference
    sqlIdentifiers.lengthlengthTYPE_COMPATIBLE_REPLACEMENT
    3
    for (int i = 0; i < length; i++)
    3
    aliases[i] = toAliasString(sqlIdentifiers[i]);
    3
    aliases[i] = toAliasString(sqlIdentifiers[i]);
    4
    result[i] = objects[i].toString();
    Differences
    Expression1Expression2Difference
    aliasesresultVARIABLE_NAME_MISMATCH
    toAliasStringtoStringMETHOD_INVOCATION_NAME_MISMATCH
    toAliasString(sqlIdentifiers[i])objects[i].toString()ARGUMENT_NUMBER_MISMATCH
    objects[i]MISSING_METHOD_INVOCATION_EXPRESSION
    Preondition Violations
    Expression toAliasString(sqlIdentifiers[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression objects[i].toString() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression toAliasString(sqlIdentifiers[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression objects[i].toString() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    result[i] = objects[i].toString();
    4
    return aliases;
    4
    return aliases;
    5
    return result;
    Differences
    Expression1Expression2Difference
    aliasesresultVARIABLE_NAME_MISMATCH
    5
    return result;
    Precondition Violations (4)
    Row Violation
    1Expression toAliasString(sqlIdentifiers[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression objects[i].toString() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression toAliasString(sqlIdentifiers[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression objects[i].toString() cannot be parameterized, because it has dependencies to/from statements that will be extracted