File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/ProjectionList.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/ProjectionList.java | |||
Method name: Type[] getTypes(Criteria, CriteriaQuery)
|
Method name: String[] getColumnAliases(int)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 6 | |||
1 | List types = new ArrayList( getLength() );↵ | 1 | List result = new ArrayList( getLength() );↵ | |
2 | for ( int i=0; i<getLength(); i++ ) {↵ | 2 | for ( int i=0; i<getLength(); i++ ) {↵ | |
3 | Type[] elemTypes = getProjection(i).getTypes(criteria, criteriaQuery);↵ | 3 | String[] colAliases = getProjection(i).get↵ | |
4 | ArrayHelper.addAll(types, elemTypes)↵ | 4 | ColumnAliases(loc);↵ | |
5 | ArrayHelper.addAll(result, colAliases);↵ | |||
5 | ;↵ | 6 | loc+=colAliases.length;↵ | |
6 | }↵ | 7 | }↵ | |
7 | return ArrayHelper.toTypeArray(types); | 8 | return ArrayHelper.toStringArray(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 declared in the same class |
Number of node comparisons | 14 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 4.4 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | List types = new ArrayList(getLength()); |
| 1 | List result = new ArrayList(getLength()); | |||||||||||||||||
2 | for (int i = 0; i < getLength(); i++) | 2 | for (int i = 0; i < getLength(); i++) | ||||||||||||||||||
|
| 3 | String[] colAliases = getProjection(i).getColumnAliases(loc); | ||||||||||||||||||
3 | Type[] elemTypes = getProjection(i).getTypes(criteria, criteriaQuery); |
| | ||||||||||||||||||
4 | ArrayHelper.addAll(types, elemTypes); |
| 4 | ArrayHelper.addAll(result, colAliases); | |||||||||||||||||
|
| 5 | loc += colAliases.length; | ||||||||||||||||||
5 | return ArrayHelper.toTypeArray(types); |
| | ||||||||||||||||||
|
| 6 | return ArrayHelper.toStringArray(result); |
Row | Violation |
---|---|
1 | Unmatched statement String[] colAliases=getProjection(i).getColumnAliases(loc); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement Type[] elemTypes=getProjection(i).getTypes(criteria,criteriaQuery); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement Type[] elemTypes=getProjection(i).getTypes(criteria,criteriaQuery); 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 | Type org.hibernate.type.Type[] of variable elemTypes does not match with type java.lang.String[] of variable colAliases |
5 | Unmatched statement loc+=colAliases.length; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement return ArrayHelper.toTypeArray(types); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Unmatched return ArrayHelper.toTypeArray(types); |
8 | Unmatched statement return ArrayHelper.toStringArray(result); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
9 | Unmatched return ArrayHelper.toStringArray(result); |
10 | Clone fragment #1 returns variables i, types , while Clone fragment #2 returns variables i, result |