String[][] columnNames = new String[types.length][]; for ( int i = 0; i < types.length; i++ ) { int span = types[i].getColumnSpan( f ); columnNames[i] = new String[span]; for ( int j = 0; j < span; j++ ) { columnNames[i][j] = NameGenerator.scalarName( i, j ); } } return columnNames;
String[] result = new String[ x.length + countTrue(use) ]; for ( int i=0; i<x.length; i++ ) result[i] = x[i]; int k = x.length; for ( int i=0; i<y.length; i++ ) { if ( use[i] ) result[k++] = y[i]; } return result;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/hql/NameGenerator.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/ArrayHelper.java
Method name: String[][] generateColumnNames(Type[], SessionFactoryImplementor) Method name: String[] join(String[], String[], boolean[])
Number of AST nodes: 7 Number of AST nodes: 8
1
String[][] columnNames = new String[types.length][];
1
String[] result = new String[ x.length + countTrue(use) ];
2
		for ( int i = 0; i < types.length; i++ ) {
2
		for ( int i=0; i<x.length; i++ ) 
3
			int span = types[i].getColumnSpan( f );
4
			columnNames[i] = new String[span]
3
result[i] = x[i];
5
;
4
		int k = x.length;
6
			for ( int j = 0; j < span; j++ ) {
5
		for ( int i=0; i<y.length; i++ ) {
7
				columnNames[i][j] = NameGenerator.scalarName( i, j );
6
			if ( use[i] ) result[k++] = y[i];
8
			}
7
		
9
		}
8
}
10
		return columnNames;
9
		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 comparisons16
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment6
    Number of unmapped statements in the second code fragment7
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                      
    1
    String[] result = new String[x.length + countTrue(use)];
    1
    String[][] columnNames = new String[types.length];
                                                                                                              
    2
    for (int i = 0; i < types.length; i++)
    2
    for (int i = 0; i < types.length; i++)
    2
    for (int i = 0; i < x.length; i++)
    Differences
    Expression1Expression2Difference
    typesxVARIABLE_NAME_MISMATCH
    org.hibernate.type.Type[]java.lang.String[]VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type int of variable types.length does not match with type int of variable x.length
    • Make classes org.hibernate.type.Type[] and java.lang.String[] extend a common superclass
    2
    for (int i = 0; i < x.length; i++)
                                        
    3
    result[i] = x[i];
    Preondition Violations
    Unmatched statement result[i]=x[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3
    result[i] = x[i];
    3
    int span = types[i].getColumnSpan(f);
    3
    int span = types[i].getColumnSpan(f);
    Preondition Violations
    Unmatched statement int span=types[i].getColumnSpan(f); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement int span=types[i].getColumnSpan(f); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                
    4
    columnNames[i] = new String[span];
    4
    columnNames[i] = new String[span];
    Preondition Violations
    Unmatched statement columnNames[i]=new String[span]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                          
    5
    for (int j = 0; j < span; j++)
    5
    for (int j = 0; j < span; j++)
    Preondition Violations
    Unmatched statement for(int j=0; j < span; j++) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                
    6
    columnNames[i][j] = NameGenerator.scalarName(i, j);
    6
    columnNames[i][j] = NameGenerator.scalarName(i, j);
    Preondition Violations
    Unmatched statement columnNames[i][j]=NameGenerator.scalarName(i,j); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                          
                                        
    4
    int k = x.length;
                                                                        
    5
    for (int i = 0; i < y.length; i++)
                              
    6
    if (use[i])
                                            
    7
    result[k++] = y[i];
    7
    return columnNames;
    7
    return columnNames;
    Preondition Violations
    Unmatched return columnNames;
                                                
                                      
    8
    return result;
    Preondition Violations
    Unmatched return result;
    8
    return result;
    Precondition Violations (10)
    Row Violation
    1Type int of variable types.length does not match with type int of variable x.length
    2Unmatched statement result[i]=x[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement int span=types[i].getColumnSpan(f); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement int span=types[i].getColumnSpan(f); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    5Unmatched statement columnNames[i]=new String[span]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement for(int j=0; j < span; j++) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement columnNames[i][j]=NameGenerator.scalarName(i,j); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched return columnNames;
    9Unmatched return result;
    10The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero