if (obj == this) { return true; } if (!(obj instanceof ColorBlock)) { return false; } ColorBlock that = (ColorBlock) obj; if (!PaintUtilities.equal(this.paint, that.paint)) { return false; } return super.equals(obj);
if (obj == this) { return true; } if (!(obj instanceof ImageTitle)) { return false; } ImageTitle that = (ImageTitle) obj; if (!ObjectUtilities.equal(this.image, that.image)) { return false; } return super.equals(obj);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/block/ColorBlock.java File path: /jfreechart-1.0.10/src/org/jfree/chart/title/ImageTitle.java
Method name: boolean equals(Object) Method name: boolean equals(Object)
Number of AST nodes: 8 Number of AST nodes: 8
1
if (obj == this) {
1
if (obj == this) {
2
            return true;
2
            return true;
3
        }
3
        }
4
        if (!(obj instanceof ColorBlock)) {
4
        if (!(obj instanceof ImageTitle)) {
5
            return false;
5
            return false;
6
        }
6
        }
7
        ColorBlock that = (ColorBlock) obj;
7
        ImageTitle that = (ImageTitle) obj;
8
        if (!PaintUtilities.equal(this.paint, that.paint)) {
8
        if (!ObjectUtilities.equal(this.image, that.image)) {
9
            return false;
9
            return false;
10
        }
10
        }
11
        return super.equals(obj);
11
        return super.equals(obj);
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)0.8
Clones locationClones are in different classes having the same super class
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.5
    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 (!(obj instanceof ColorBlock))
    3
    if (!(obj instanceof ColorBlock))
    3
    if (!(obj instanceof ImageTitle))
    Differences
    Expression1Expression2Difference
    org.jfree.chart.block.ColorBlockorg.jfree.chart.title.ImageTitleSUBCLASS_TYPE_MISMATCH
    3
    if (!(obj instanceof ImageTitle))
    4
    return false;
    4
    return false;
    5
    ColorBlock that = (ColorBlock)obj;
    5
    ColorBlock that = (ColorBlock)obj;
    5
    ImageTitle that = (ImageTitle)obj;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.block.ColorBlockorg.jfree.chart.title.ImageTitleSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.block.ColorBlockorg.jfree.chart.title.ImageTitleSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.block.ColorBlockorg.jfree.chart.title.ImageTitleSUBCLASS_TYPE_MISMATCH
    5
    ImageTitle that = (ImageTitle)obj;
    6
    if (!PaintUtilities.equal(this.paint, that.paint))
    6
    if (!PaintUtilities.equal(this.paint, that.paint))
    6
    if (!ObjectUtilities.equal(this.image, that.image))
    Differences
    Expression1Expression2Difference
    paintimageVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.ImageVARIABLE_TYPE_MISMATCH
    org.jfree.chart.block.ColorBlockorg.jfree.chart.title.ImageTitleSUBCLASS_TYPE_MISMATCH
    paintimageVARIABLE_NAME_MISMATCH
    java.awt.Paintjava.awt.ImageVARIABLE_TYPE_MISMATCH
    org.jfree.util.PaintUtilitiesorg.jfree.util.ObjectUtilitiesVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable this.paint does not match with type java.awt.Image of variable this.image
    • Make classes java.awt.Paint and java.awt.Image extend a common superclass
    Expression that.paint cannot be unified with expression that.image , because common superclass type java.lang.Object cannot be passed as an argument to public static boolean equal(java.awt.Paint, java.awt.Paint)
    Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression that.image cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type java.awt.Paint of variable that.paint does not match with type java.awt.Image of variable that.image
    • Make classes java.awt.Paint and java.awt.Image extend a common superclass
    Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    • Make classes org.jfree.util.PaintUtilities and org.jfree.util.ObjectUtilities extend a common superclass
    6
    if (!ObjectUtilities.equal(this.image, that.image))
    7
    return false;
    7
    return false;
    8
    return super.equals(obj);
    8
    return super.equals(obj);
    8
    return super.equals(obj);
    Preondition Violations
    Super method call return super.equals(obj); cannot be extracted from method
    Super method call return super.equals(obj); cannot be extracted from method
    8
    return super.equals(obj);
    Precondition Violations (8)
    Row Violation
    1Type java.awt.Paint of variable this.paint does not match with type java.awt.Image of variable this.image
    2Expression that.paint cannot be unified with expression that.image , because common superclass type java.lang.Object cannot be passed as an argument to public static boolean equal(java.awt.Paint, java.awt.Paint)
    3Expression that.paint cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression that.image cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Type java.awt.Paint of variable that.paint does not match with type java.awt.Image of variable that.image
    6Type org.jfree.util.PaintUtilities does not match with type org.jfree.util.ObjectUtilities
    7Super method call return super.equals(obj); cannot be extracted from method
    8Super method call return super.equals(obj); cannot be extracted from method