398-6-10

if (obj == this) { return true; } if (!(obj instanceof AbstractDialLayer)) { return false; } AbstractDialLayer that = (AbstractDialLayer) obj; return this.visible == that.visible;
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/plot/dial/AbstractDialLayer.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 AbstractDialLayer)) {↵

4

                if (!(obj instanceof TestDra↵

5

    wable)) {↵

5

                return false;
    ↵

6

                    return false;↵

6

            }↵

7

           ↵

7

            AbstractDialLayer that = (AbstractDialLayer) obj;↵

8

         ↵

8

            return this.visible == that.visibl↵

9

    }↵

9

    e;

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) | 0.8
   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 AbstractDialLayer))

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.dial.AbstractDialLayer | org.jfree.chart.annotations.junit.XYDrawableAnnotationTests.TestDrawable | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   3

       if (!(obj instanceof TestDrawable))

   4

       return false;

   4

       return false;

   5

       AbstractDialLayer that = (AbstractDialLayer)obj;

   6

       return this.visible == that.visible;

   6 | return this.visible == that.visible;
   5 | return true;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   this.visible == that.visible | true | TYPE_COMPATIBLE_REPLACEMENT

   5

       return true;

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