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; | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.1 |
Clones location | Clones are in different classes |
Number of node comparisons | 16 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 6 |
Number of unmapped statements in the second code fragment | 7 |
Time elapsed for statement mapping (ms) | 1.6 |
Clone type | Type 3 |
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 < x.length; i++) | ||||||||||||||
|
| 3 | result[i] = x[i]; | |||||||||||||||
3 | int span = types[i].getColumnSpan(f); |
| | |||||||||||||||
4 | columnNames[i] = new String[span]; |
| | |||||||||||||||
5 | for (int j = 0; j < span; j++) |
| | |||||||||||||||
6 | columnNames[i][j] = NameGenerator.scalarName(i, j); |
| | |||||||||||||||
| 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; |
| | |||||||||||||||
|
| 8 | return result; |
Row | Violation |
---|---|
1 | Type int of variable types.length does not match with type int of variable x.length |
2 | 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 | 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 |
4 | 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 |
5 | 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 |
6 | 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 |
7 | 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 |
8 | Unmatched return columnNames; |
9 | Unmatched return result; |
10 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero |