File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/PersistentList.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/PersistentSet.java | |||
Method name: Serializable getSnapshot(CollectionPersister)
|
Method name: Serializable getSnapshot(CollectionPersister)
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | EntityMode entityMode = getSession().getEntityMode();↵ | 1 | EntityMode entityMode = getSession().getEntityMode();↵ | |
2 | ↵ | |||
2 | ArrayList↵ | 3 | //if (set==null) return new Set(session);↵ | |
3 | clonedList = new ArrayList( list.size() );↵ | 4 | HashMap clonedSet = new HashMap( set.size() );↵ | |
4 | Iterator iter = list.iterator();↵ | 5 | Iterator iter = set.iterator();↵ | |
5 | while ( iter.hasNext() ) {↵ | 6 | while ( iter.hasNext() ) {↵ | |
6 | Object deepCopy = persister.getElementType()↵ | 7 | Object copied = persister.getElementType()↵ | |
7 | .deepCopy( iter.next(), entityMode, persister.getFactory() );↵ | 8 | .deepCopy( iter.next(), entityMode, persister.getFactory() );↵ | |
8 | clonedList.add( deepCopy );↵ | 9 | clonedSet.put(copied, copied);↵ | |
9 | }↵ | 10 | }↵ | |
10 | return clonedList; | 11 | return clonedSet; | |
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 | 25 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 1.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | EntityMode entityMode = getSession().getEntityMode(); | 1 | EntityMode entityMode = getSession().getEntityMode(); | |||||||||||||||
| 2 | HashMap clonedSet = new HashMap(set.size()); | ||||||||||||||||
2 | ArrayList clonedList = new ArrayList(list.size()); | | ||||||||||||||||
3 | Iterator iter = list.iterator(); |
| 3 | Iterator iter = set.iterator(); | ||||||||||||||
4 | while (iter.hasNext()) | 4 | while (iter.hasNext()) | |||||||||||||||
5 | Object deepCopy = persister.getElementType().deepCopy(iter.next(), entityMode, persister.getFactory()); |
| 5 | Object copied = persister.getElementType().deepCopy(iter.next(), entityMode, persister.getFactory()); | ||||||||||||||
|
| 6 | clonedSet.put(copied, copied); | |||||||||||||||
6 | clonedList.add(deepCopy); |
| | |||||||||||||||
|
| 7 | return clonedSet; | |||||||||||||||
7 | return clonedList; |
| |
Row | Violation |
---|---|
1 | Type java.util.List of variable list does not match with type java.util.Set of variable set |
2 | Unmatched statement clonedSet.put(copied,copied); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement clonedList.add(deepCopy); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched return clonedSet; |
5 | Unmatched return clonedList; |