if (obj == this) { return true; } // now try to reject equality if (!super.equals(obj)) { return false; } if (!(obj instanceof XYPolygonAnnotation)) { return false; } XYPolygonAnnotation that = (XYPolygonAnnotation) obj; if (!Arrays.equals(this.polygon, that.polygon)) { 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/XYPolygonAnnotation.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 XYPolygonAnnotation)) {
7
        if (!(obj instanceof WaterfallBarRenderer)) {
9
            return false;
8
            return false;
10
        }
9
        }
11
        XYPolygonAnnotation that = (XYPolygonAnnotation) obj;
10
        WaterfallBarRenderer that = (WaterfallBarRenderer) obj;
12
        if (!Arrays.equals(this.polygon, that.polygon)) {
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)6.8
Clones locationClones are in different classes
Number of node comparisons98
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.7
    Clone typeType 3
    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 XYPolygonAnnotation))
    5
    if (!(obj instanceof XYPolygonAnnotation))
    5
    if (!(obj instanceof WaterfallBarRenderer))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    5
    if (!(obj instanceof WaterfallBarRenderer))
    6
    return false;
    6
    return false;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    7
    XYPolygonAnnotation that = (XYPolygonAnnotation)obj;
    7
    WaterfallBarRenderer that = (WaterfallBarRenderer)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    7
    WaterfallBarRenderer that = (WaterfallBarRenderer)obj;
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    8
    if (!Arrays.equals(this.polygon, that.polygon))
    Preondition Violations
    Unmatched statement if(!Arrays.equals(this.polygon,that.polygon)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                    
    9
    return false;
    9
    return false;
    Preondition Violations
    Unmatched 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.XYPolygonAnnotationorg.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.XYPolygonAnnotationorg.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))
    8
    if (!PaintUtilities.equal(this.firstBarPaint, that.firstBarPaint))
    Differences
    Expression1Expression2Difference
    fillPaintfirstBarPaintVARIABLE_NAME_MISMATCH
    org.jfree.chart.annotations.XYPolygonAnnotationorg.jfree.chart.renderer.category.WaterfallBarRendererSUBCLASS_TYPE_MISMATCH
    fillPaintfirstBarPaintVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression that.fillPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.firstBarPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (!PaintUtilities.equal(this.firstBarPaint, that.firstBarPaint))
    15
    return false;
    9
    return false;
    Precondition Violations (16)
    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
    3Unmatched statement if(!Arrays.equals(this.polygon,that.polygon)) cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched return false;
    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.firstBarPaint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Clone fragment #1 returns variable that with type org.jfree.chart.annotations.XYPolygonAnnotation , while Clone fragment #2 returns variable that with type org.jfree.chart.renderer.category.WaterfallBarRenderer
    15Not all possible execution flows end in a return statement
    16The refactoring of the clones is infeasible, because classes org.jfree.chart.annotations.XYPolygonAnnotation and org.jfree.chart.renderer.category.WaterfallBarRenderer do not have a common superclass