398-5-10

if (obj == this) { return true; } if (!(obj instanceof TickUnits)) { return false; } TickUnits that = (TickUnits) obj; return that.tickUnits.equals(this.tickUnits);
if (obj == this) { return true; } if (!(obj instanceof TestDrawable)) { return false; } return true;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/TickUnits.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/annotations/junit/XYDrawableAnnotationTests.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 6 |  | Number of AST nodes: 5

1

    if (obj == this) {
    ↵

1

    if (obj == this) {↵

2

                return true;
    ↵

2

                    return true;↵

3

            }
    ↵

3

                }↵

4

            if (!(obj instanceof TickUnits)) {↵

4

                if (!(obj instanceof T↵

5

    estDrawable)) {↵

5

                return false;
    ↵

6

                    return false;↵

6

            }↵

7

            ↵

7

        ↵

8

        }↵

8

        TickUnits that = (TickUnits) obj;↵

9

        ↵

9

            return that.tickUnits.equals(this.tickUnits);

10

            return true;

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.3
Clones location | Clones are in different classes
Number of node comparisons | 15

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 5
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 2.1
   Clone type | Type 3

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       if (obj == this)

   1

       if (obj == this)

   2

       return true;

   2

       return true;

   3

       if (!(obj instanceof TickUnits))

   3 | if (!(obj instanceof TickUnits))
   3 | if (!(obj instanceof TestDrawable))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.axis.TickUnits | org.jfree.chart.annotations.junit.XYDrawableAnnotationTests.TestDrawable | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof TickUnits does not match with type boolean of variable obj instanceof TestDrawable
   - Make classes org.jfree.chart.axis.TickUnits and org.jfree.chart.annotations.junit.XYDrawableAnnotationTests.TestDrawable extend a common superclass

   3

       if (!(obj instanceof TestDrawable))

   4

       return false;

   4

       return false;

   5

       TickUnits that = (TickUnits)obj;

   6

       return that.tickUnits.equals(this.tickUnits);

   6 | return that.tickUnits.equals(this.tickUnits);
   5 | return true;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   that.tickUnits.equals(this.tickUnits) | true | TYPE_COMPATIBLE_REPLACEMENT

   5

       return true;

   Precondition Violations (1)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof TickUnits does not match with type boolean of variable obj instanceof TestDrawable