File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/action/CollectionAction.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/action/EntityAction.java | |||
Method name: int compareTo(Object)
|
Method name: int compareTo(Object)
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | CollectionAction action = ( CollectionAction ) other;↵ | 1 | EntityAction action = ( EntityAction ) other;↵ | |
2 | //sort first by role name↵ | 2 | //sort first by entity name↵ | |
3 | int roleComparison = collectionRole.compareTo( action.collectionRole );↵ | 3 | int roleComparison = entityName.compareTo( action.entityName );↵ | |
4 | if ( roleComparison != 0 ) {↵ | 4 | if ( roleComparison != 0 ) {↵ | |
5 | return roleComparison;↵ | 5 | return roleComparison;↵ | |
6 | }↵ | 6 | }↵ | |
7 | else {↵ | 7 | else {↵ | |
8 | //then by fk↵ | 8 | //then by id↵ | |
9 | return persister.getKeyType()↵ | 9 | return persister.get↵ | |
10 | .compare( key, action.key, session.getEntityMode() );↵ | 10 | IdentifierType().compare( id, action.id, session.getEntityMode() );↵ | |
11 | } | 11 |
| |
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 | 13 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 3.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | CollectionAction action = (CollectionAction)other; |
| 1 | EntityAction action = (EntityAction)other; | ||||||||||||||||||
2 | int roleComparison = collectionRole.compareTo(action.collectionRole); |
| 2 | int roleComparison = entityName.compareTo(action.entityName); | ||||||||||||||||||
3 | if (roleComparison != 0) | 3 | if (roleComparison != 0) | |||||||||||||||||||
4 | return roleComparison; | 4 | return roleComparison; | |||||||||||||||||||
else | | |||||||||||||||||||||
|
| 5 | return persister.getIdentifierType().compare(id, action.id, session.getEntityMode()); | |||||||||||||||||||
5 | return persister.getKeyType().compare(key, action.key, session.getEntityMode()); |
| |
Row | Violation |
---|---|
1 | Expression action.collectionRole cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression action.entityName cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement return persister.getIdentifierType().compare(id,action.id,session.getEntityMode()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched return persister.getIdentifierType().compare(id,action.id,session.getEntityMode()); |
5 | Unmatched statement return persister.getKeyType().compare(key,action.key,session.getEntityMode()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Unmatched return persister.getKeyType().compare(key,action.key,session.getEntityMode()); |
7 | Clone fragment #1 returns variable action with type org.hibernate.action.CollectionAction , while Clone fragment #2 returns variable action with type org.hibernate.action.EntityAction |
8 | Not all possible execution flows end in a return statement |