if (obj == this) { return true; } // now try to reject equality if (!super.equals(obj)) { return false; } if (!(obj instanceof XYShapeAnnotation)) { return false; } XYShapeAnnotation that = (XYShapeAnnotation) obj; if (!this.shape.equals(that.shape)) { return false; } if (!ObjectUtilities.equal(this.stroke, that.stroke)) { return false; } if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint)) { return false; } if (!PaintUtilities.equal(this.fillPaint, that.fillPaint)) { return false; } // seem to be the same return true;
if (obj == this) { return true; } if (!super.equals(obj)) { return false; } if (!(obj instanceof WaterfallBarRenderer)) { return false; } WaterfallBarRenderer that = (WaterfallBarRenderer) obj; if (!PaintUtilities.equal(this.firstBarPaint, that.firstBarPaint)) { return false; } if (!PaintUtilities.equal(this.lastBarPaint, that.lastBarPaint)) { return false; } if (!PaintUtilities.equal(this.positiveBarPaint, that.positiveBarPaint)) { return false; } if (!PaintUtilities.equal(this.negativeBarPaint, that.negativeBarPaint)) { return false; } return true;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/annotations/XYShapeAnnotation.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/WaterfallBarRenderer.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 16 Number of AST nodes: 16
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        // now try to reject equality
5
        if (!super.equals(obj)) {
4
        if (!super.equals(obj)) {
6
            return false;
5
            return false;
7
        }
6
        }
8
        if (!(obj instanceof XYShapeAnnotation)) {
7
        if (!(obj instanceof WaterfallBarRenderer)) {
9
            return false;
8
            return false;
10
        }
9
        }
11
        XYShapeAnnotation that = (XYShapeAnnotation) obj;
10
        WaterfallBarRenderer that = (WaterfallBarRenderer) obj;
12
        if (!this.shape.equals(that.shape)) {
11
        if (!PaintUtilities.equal(this.firstBarPaint, that.firstBarPaint)) {
13
            return false;
12
            return false;
14
        }
13
        }
15
        if (!ObjectUtilities.equal(this.stroke, that.stroke)) {
14
        if (!PaintUtilities.equal(this.lastBarPaint, that.lastBarPaint)) {
16
            return false;
15
            return false;
17
        }
16
        }
18
        if (!PaintUtilities.equal(this.outlinePaint, that.outline
17
        if (!PaintUtilities.equal(this.positiveBarPaint,
19
Paint)) {
18
                that.positiveBarPaint)) {
20
            return false;
19
            return false;
21
        }
20
        }
22
        if (!PaintUtilities.equal(this.fillPaint, that.fill
21
        if (!PaintUtilities.equal(this.negativeBarPaint,
23
Paint)) {
22
                that.negativeBarPaint)) {
24
            return false;
23
            return false;
25
        }
24
        }
26
        // seem to be the same
27
        return true;
25
        return true;
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)5.7
Clones locationClones are in different classes
Number of node comparisons119
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements16
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)6.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (obj == this)
    1
    if (obj == this)
    2
    return true;
    2
    return true;
    3
    if (!super.equals(obj))
    3
    if (!super.equals(obj))
    3
    if (!super.equals(obj))
    Preondition Violations
    Super method call if(!super.equals(obj)) cannot be extracted from method
    Super method call if(!super.equals(obj)) cannot be extracted from method
    3
    if (!super.equals(obj))
    4
    return false;
    4
    return false;
    5
    if (!(obj instanceof XYShapeAnnotation))
    5
    if (!(obj instanceof XYShapeAnnotation))
    5
    if (!(obj instanceof WaterfallBarRenderer))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    5
    if (!(obj instanceof WaterfallBarRenderer))
    6
    return false;
    6
    return false;
    7
    XYShapeAnnotation that = (XYShapeAnnotation)obj;
    7
    XYShapeAnnotation that = (XYShapeAnnotation)obj;
    7
    WaterfallBarRenderer that = (WaterfallBarRenderer)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    7
    WaterfallBarRenderer that = (WaterfallBarRenderer)obj;
    8
    if (!this.shape.equals(that.shape))
    8
    if (!this.shape.equals(that.shape))
    8
    if (!PaintUtilities.equal(this.firstBarPaint, that.firstBarPaint))
    Differences
    Expression1Expression2Difference
    this.shape.equals(that.shape)PaintUtilities.equal(this.firstBarPaint,that.firstBarPaint)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression this.shape.equals(that.shape) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression PaintUtilities.equal(this.firstBarPaint,that.firstBarPaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!PaintUtilities.equal(this.firstBarPaint, that.firstBarPaint))
    9
    return false;
    9
    return false;
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    10
    if (!ObjectUtilities.equal(this.stroke, that.stroke))
    10
    if (!PaintUtilities.equal(this.lastBarPaint, that.lastBarPaint))
    Differences
    Expression1Expression2Difference
    strokelastBarPaintVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    strokelastBarPaintVARIABLE_NAME_MISMATCH
    java.awt.Strokejava.awt.PaintVARIABLE_TYPE_MISMATCH
    org.jfree.util.ObjectUtilitiesorg.jfree.util.PaintUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Stroke of variable this.stroke does not match with type java.awt.Paint of variable this.lastBarPaint
    • Make classes java.awt.Stroke and java.awt.Paint extend a common superclass
    Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.lastBarPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Stroke of variable that.stroke does not match with type java.awt.Paint of variable that.lastBarPaint
    • Make classes java.awt.Stroke and java.awt.Paint extend a common superclass
    Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    • Make classes org.jfree.util.ObjectUtilities and org.jfree.util.PaintUtilities extend a common superclass
    10
    if (!PaintUtilities.equal(this.lastBarPaint, that.lastBarPaint))
    11
    return false;
    11
    return false;
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!PaintUtilities.equal(this.outlinePaint, that.outlinePaint))
    12
    if (!PaintUtilities.equal(this.positiveBarPaint, that.positiveBarPaint))
    Differences
    Expression1Expression2Difference
    outlinePaintpositiveBarPaintVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    outlinePaintpositiveBarPaintVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.outlinePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.positiveBarPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    if (!PaintUtilities.equal(this.positiveBarPaint, that.positiveBarPaint))
    13
    return false;
    13
    return false;
    14
    if (!PaintUtilities.equal(this.fillPaint, that.fillPaint))
    14
    if (!PaintUtilities.equal(this.fillPaint, that.fillPaint))
    14
    if (!PaintUtilities.equal(this.negativeBarPaint, that.negativeBarPaint))
    Differences
    Expression1Expression2Difference
    fillPaintnegativeBarPaintVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYShapeAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    fillPaintnegativeBarPaintVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.fillPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.negativeBarPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14
    if (!PaintUtilities.equal(this.negativeBarPaint, that.negativeBarPaint))
    15
    return false;
    15
    return false;
    16
    return true;
    16
    return true;
    Precondition Violations (14)
    Row Violation
    1Super method call if(!super.equals(obj)) cannot be extracted from method
    2Super method call if(!super.equals(obj)) cannot be extracted from method
    3Expression this.shape.equals(that.shape) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression PaintUtilities.equal(this.firstBarPaint,that.firstBarPaint) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type java.awt.Stroke of variable this.stroke does not match with type java.awt.Paint of variable this.lastBarPaint
    6Expression that.stroke cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression that.lastBarPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Type java.awt.Stroke of variable that.stroke does not match with type java.awt.Paint of variable that.lastBarPaint
    9Type org.jfree.util.ObjectUtilities does not match with type org.jfree.util.PaintUtilities
    10Expression that.outlinePaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression that.positiveBarPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression that.fillPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression that.negativeBarPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYShapeAnnotation and org.jfree.chart.renderer.category.WaterfallBarRenderer do not have a common superclass