File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/MultipleHiLoPerTableGenerator.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/id/TableHiLoGenerator.java | |||
Method name: Serializable generate(SessionImplementor, Object)
|
Method name: Serializable generate(SessionImplementor, Object)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | if (lo>maxLo) {↵ | 1 | if (lo>maxLo) {↵ | |
2 | int hival = ( (Integer) doWorkInNewTransaction(session) ).intValue();↵ | 2 | long hival = ( (Number) super.generate(session, obj) ).longValue();↵ | |
3 | lo = (hival == 0) ? 1 : 0;↵ | 3 | lo = (hival == 0) ? 1 : 0;↵ | |
4 | hi = hival * (maxLo+1);↵ | 4 | hi = hival * (maxLo+1);↵ | |
5 | log.debug("new hi value: " + hival);↵ | 5 | log.debug("new hi value: " + hival);↵ | |
6 | } | 6 |
| |
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 having the same super class |
Number of node comparisons | 17 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | if (lo > maxLo) | 6 | if (lo > maxLo) | ||||||||||||
|
| 7 | long hival = ((Number)super.generate(session, obj)).longValue(); | ||||||||||||
7 | int hival = ((Integer)doWorkInNewTransaction(session)).intValue(); |
| | ||||||||||||
8 | lo = (hival == 0) ? 1 : 0; |
| 8 | lo = (hival == 0) ? 1 : 0; | |||||||||||
|
| 9 | hi = hival * (maxLo + 1); | ||||||||||||
9 | hi = hival * (maxLo + 1); |
| | ||||||||||||
10 | log.debug("new hi value: " + hival); |
| 10 | log.debug("new hi value: " + hival); |
Row | Violation |
---|---|
1 | Unmatched statement long hival=((Number)super.generate(session,obj)).longValue(); 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 |
2 | Unmatched statement int hival=((Integer)doWorkInNewTransaction(session)).intValue(); 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 |
3 | Type int of variable hival does not match with type long of variable hival |
4 | Unmatched statement hi=hival * (maxLo + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
5 | Unmatched statement hi=hival * (maxLo + 1); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
6 | Type int of variable hival does not match with type long of variable hival |
7 | The refactoring of the clones is infeasible, because classes org.hibernate.id.MultipleHiLoPerTableGenerator and org.hibernate.id.TableHiLoGenerator do not have a common superclass |