Collection stays = getVeryOldStays(); if ( stays == null ) { stays = new ArrayList(); } stays.add( stay ); this.veryOldStays = stays;
Collection stays = getStays(); if ( stays == null ) { stays = new ArrayList(); } stays.add( stay ); this.stays = 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 addStay(Stay)
Number of AST nodes: 5 Number of AST nodes: 5
1
Collection stays = getVeryOldStays();
1
Collection stays = getStays();
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.stays = stays;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are declared in the same class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Collection stays = getVeryOldStays();
    1
    Collection stays = getVeryOldStays();
    1
    Collection stays = getStays();
    Differences
    Expression1Expression2Difference
    getVeryOldStaysgetStaysMETHOD_INVOCATION_NAME_MISMATCH
    1
    Collection stays = getStays();
    2
    if (stays == null)
    2
    if (stays == null)
    3
    stays = new ArrayList();
    3
    stays = new ArrayList();
    4
    stays.add(stay);
    4
    stays.add(stay);
    5
    this.veryOldStays = stays;
    5
    this.veryOldStays = stays;
    5
    this.stays = stays;
    Differences
    Expression1Expression2Difference
    veryOldStaysstaysVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression this.veryOldStays is a field being modified, and thus it cannot be parameterized
    Expression this.stays is a field being modified, and thus it cannot be parameterized
    5
    this.stays = stays;
    Precondition Violations (2)
    Row Violation
    1Expression this.veryOldStays is a field being modified, and thus it cannot be parameterized
    2Expression this.stays is a field being modified, and thus it cannot be parameterized