File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/PersistentBag.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/ProjectionList.java | |||
Method name: Serializable disassemble(CollectionPersister)
|
Method name: String[] getColumnAliases(int)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 6 | |||
1 | int length = bag.size();↵ | |||
2 | Serializable[] result = new Serializable[length];↵ | 1 | List result = new ArrayList( getLength() );↵ | |
3 | for ( int i=0; i<length; i++ ) {↵ | 2 | for ( int i=0; i<getLength(); i++ ) {↵ | |
4 | result[i] = persister.getElementType().disassemble( bag.get(i), getSession(), null );↵ | 3 | ↵ | |
5 | }↵ | |||
6 | return ↵ | 4 | String[] colAliases = getProjection(i).getColumnAliases(loc);↵ | |
5 | ArrayHelper.addAll(result, colAliases);↵ | |||
6 | loc+=colAliases.length;↵ | |||
7 | }↵ | |||
7 | result; | 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.2 |
Clones location | Clones are in different classes |
Number of node comparisons | 14 |
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 4 |
Number of unmapped statements in the second code fragment | 5 |
Time elapsed for statement mapping (ms) | 1.4 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | List result = new ArrayList(getLength()); | |||||||||||||
1 | int length = bag.size(); | | |||||||||||||
2 | Serializable[] result = new Serializable[length]; | | |||||||||||||
3 | for (int i = 0; i < length; i++) |
| 2 | for (int i = 0; i < getLength(); i++) | |||||||||||
|
| 3 | String[] colAliases = getProjection(i).getColumnAliases(loc); | ||||||||||||
| 4 | ArrayHelper.addAll(result, colAliases); | |||||||||||||
4 | result[i] = persister.getElementType().disassemble(bag.get(i), getSession(), null); |
| | ||||||||||||
|
| 5 | loc += colAliases.length; | ||||||||||||
5 | return result; |
| | ||||||||||||
|
| 6 | return ArrayHelper.toStringArray(result); |
Row | Violation |
---|---|
1 | Expression length cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | 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 |
3 | Unmatched statement result[i]=persister.getElementType().disassemble(bag.get(i),getSession(),null); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement result[i]=persister.getElementType().disassemble(bag.get(i),getSession(),null); 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 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 return result; |
7 | Unmatched return ArrayHelper.toStringArray(result); |
8 | The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero |