Collection stays = getVeryOldStays();
if ( stays == null ) {
stays = new ArrayList();
}
stays.add( stay );
this.veryOldStays = stays;
Collection stays = getOldStays();
if ( stays == null ) {
stays = new ArrayList();
}
stays.add( stay );
this.oldStays = stays;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/jpa/fetch/Person.java
|
|
File path: /hibernate-distribution-3.3.2.GA/project/testsuite/src/test/java/org/hibernate/test/jpa/fetch/Person.java
|
Method name: void addVeryOldStay(Stay)
|
|
Method name: void addOldStay(Stay)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | Collection stays = getVeryOldStays();↵ | | 1 | Collection stays = getOldStays();↵
|
2 | if ( stays == null ) {↵ | | 2 | if ( stays == null ) {↵
|
3 | stays = new ArrayList();↵ | | 3 | stays = new ArrayList();↵
|
4 | }↵ | | 4 | }↵
|
5 | stays.add( stay );↵ | | 5 | stays.add( stay );↵
|
|
6 | this.veryOldStays = stays; | | 6 | this.oldStays = stays;
|
See real code fragment |
|
See real code fragment |
Summary
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 | 9 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 0.6 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | Collection stays = getVeryOldStays(); | | 1 | Collection stays = getOldStays(); |
2 | if (stays == null) | | 2 | if (stays == null) |
3 | | | 3 | |
4 | stays.add(stay); | | 4 | stays.add(stay); |
5 | this.veryOldStays = stays; | | 5 | this.oldStays = stays; |
Precondition Violations (2)
Row |
Violation |
1 | Expression this.veryOldStays is a field being modified, and thus it cannot be parameterized |
2 | Expression this.oldStays is a field being modified, and thus it cannot be parameterized |