43-100-102

if (obj == this) { return true; } if (!(obj instanceof ComparableObjectItem)) { return false; } ComparableObjectItem that = (ComparableObjectItem) obj; if (!this.x.equals(that.x)) { return false; } if (!ObjectUtilities.equal(this.obj, that.obj)) { return false; } return true;
if (obj == this) { return true; } if (!(obj instanceof StatisticalBarRenderer)) { return false; } StatisticalBarRenderer that = (StatisticalBarRenderer) obj; if (!PaintUtilities.equal(this.errorIndicatorPaint, that.errorIndicatorPaint)) { return false; } if (!ObjectUtilities.equal(this.errorIndicatorStroke, that.errorIndicatorStroke)) { return false; } return super.equals(obj);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/ComparableObjectItem.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/StatisticalBarRenderer.java
Method name: `boolean equals(Object)` |  | Method name: `boolean equals(Object)`
Number of AST nodes: 10 |  | Number of AST nodes: 10

1

    if (obj == this) {↵

1

    if (obj == this) {↵

2

                return true;↵

2

                return true;↵

3

            }↵

3

            }↵

4

            if (!(obj instanceof ComparableObjectItem)) {↵

4

            if (!(obj instanceof StatisticalBarRenderer)) {↵

5

                return false;↵

5

                return false;↵

6

            }↵

6

            }↵

7

            ComparableObjectItem that = (ComparableObjectItem) obj;↵

7

            StatisticalBarRenderer that = (StatisticalBarRenderer) obj;↵

8

            if (!this.x.equals(that.x↵

8

            if (!PaintUtilities.equal(this.errorIndicatorPaint,↵

9

    )) {↵

9

                    that.errorIndicatorPaint)) {↵

10

                return false;↵

10

                return false;↵

11

            }↵

11

            }↵

12

            if (!ObjectUtilities.equal(this.obj, that.obj↵

12

            if (!ObjectUtilities.equal(this.errorIndicatorStroke,↵

13

    )) {↵

13

                    that.errorIndicatorStroke)) {↵

14

                return false;↵

14

                return false;↵

15

            }↵

15

            }↵

16

            return true;

16

            return super.equals(obj);

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

1. {Non-refactorable}

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

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

   1

       if (obj == this)

   1

       if (obj == this)

   2

       return true;

   2 | return true;
   2 | return true;

   Preondition Violations
   Conditional return true;
   Conditional return true;

   2

       return true;

   3

       if (!(obj instanceof ComparableObjectItem))

   3 | if (!(obj instanceof ComparableObjectItem))
   3 | if (!(obj instanceof StatisticalBarRenderer))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.data.ComparableObjectItem | org.jfree.chart.renderer.category.StatisticalBarRenderer | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type boolean of variable obj instanceof ComparableObjectItem does not match with type boolean of variable obj instanceof StatisticalBarRenderer
   - Make classes org.jfree.data.ComparableObjectItem and org.jfree.chart.renderer.category.StatisticalBarRenderer extend a common superclass

   3

       if (!(obj instanceof StatisticalBarRenderer))

   4

       return false;

   4 | return false;
   4 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   4

       return false;

   5

       StatisticalBarRenderer that = (StatisticalBarRenderer)obj;

   5

       ComparableObjectItem that = (ComparableObjectItem)obj;

   6

       if (!this.x.equals(that.x))

   7

       return false;

   7 | return false;

   Preondition Violations
   Unmatched return false;

   8

       if (!ObjectUtilities.equal(this.obj, that.obj))

   8 | if (! ObjectUtilities.equal(this.obj, that.obj))
   6 | if (! PaintUtilities.equal(this.errorIndicatorPaint, that.errorIndicatorPaint))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   obj | errorIndicatorPaint | VARIABLE_NAME_MISMATCH
   java.lang.Object | java.awt.Paint | VARIABLE_TYPE_MISMATCH
   org.jfree.util.ObjectUtilities | org.jfree.util.PaintUtilities | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.lang.Object of variable this.obj does not match with type java.awt.Paint of variable this.errorIndicatorPaint
   - Make classes java.lang.Object and java.awt.Paint extend a common superclass

   Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.PaintUtilities of variable PaintUtilities
   - Make classes org.jfree.util.ObjectUtilities and org.jfree.util.PaintUtilities extend a common superclass

   6

       if (!PaintUtilities.equal(this.errorIndicatorPaint, that.errorIndicatorPaint))

   9

       return false;

   9 | return false;
   7 | return false;

   Preondition Violations
   Conditional return false;
   Conditional return false;

   7

       return false;

   Precondition Violations (10)
   Row | Violation
   --- | ---
   1 | Type boolean of variable obj instanceof ComparableObjectItem does not match with type boolean of variable obj instanceof StatisticalBarRenderer
   2 | Unmatched return false;
   3 | Type java.lang.Object of variable this.obj does not match with type java.awt.Paint of variable this.errorIndicatorPaint
   4 | Type org.jfree.util.ObjectUtilities of variable ObjectUtilities does not match with type org.jfree.util.PaintUtilities of variable PaintUtilities
   5 | Conditional return true;
   6 | Conditional return true;
   7 | Conditional return false;
   8 | Conditional return false;
   9 | Conditional return false;
   10 | Conditional return false;