XYBlockRenderer clone = (XYBlockRenderer) super.clone(); if (this.paintScale instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.paintScale; clone.paintScale = (PaintScale) pc.clone(); } return clone;
XYBarDataset clone = (XYBarDataset) super.clone(); if (this.underlying instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.underlying; clone.underlying = (XYDataset) pc.clone(); } return clone;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/xy/XYBlockRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/data/xy/XYBarDataset.java
Method name: Object clone() Method name: Object clone()
Number of AST nodes: 5 Number of AST nodes: 5
1
XYBlockRenderer clone = (XYBlockRenderer) super.clone();
1
XYBarDataset clone = (XYBarDataset) super.clone();
2
        if (this.paintScale instanceof PublicCloneable) {
2
        if (this.underlying instanceof PublicCloneable) {
3
            PublicCloneable pc = (PublicCloneable) this.paintScale;
3
        	PublicCloneable pc = (PublicCloneable) this.underlying;
4
            clone.paintScale = (PaintScale) pc.clone();
4
            clone.underlying = (XYDataset) pc.clone();
5
        }
5
        }
6
        return clone;
6
        return clone;
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.3
Clones locationClones are in different classes
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)4.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    XYBlockRenderer clone = (XYBlockRenderer)super.clone();
    1
    XYBlockRenderer clone = (XYBlockRenderer)super.clone();
    1
    XYBarDataset clone = (XYBarDataset)super.clone();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.xy.XYBlockRendererorg.jfree.data.xy.XYBarDatasetSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.xy.XYBlockRendererorg.jfree.data.xy.XYBarDatasetSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.renderer.xy.XYBlockRendererorg.jfree.data.xy.XYBarDatasetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Super method call XYBlockRenderer clone=(XYBlockRenderer)super.clone(); cannot be extracted from method
    Super method call XYBarDataset clone=(XYBarDataset)super.clone(); cannot be extracted from method
    1
    XYBarDataset clone = (XYBarDataset)super.clone();
    2
    if (this.paintScale instanceof PublicCloneable)
    2
    if (this.paintScale instanceof PublicCloneable)
    2
    if (this.underlying instanceof PublicCloneable)
    Differences
    Expression1Expression2Difference
    paintScaleunderlyingVARIABLE_NAME_MISMATCH
    org.jfree.chart.renderer.PaintScaleorg.jfree.data.xy.XYDatasetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.renderer.PaintScale of variable this.paintScale does not match with type org.jfree.data.xy.XYDataset of variable this.underlying
    • Make classes org.jfree.chart.renderer.PaintScale and org.jfree.data.xy.XYDataset extend a common superclass
    2
    if (this.underlying instanceof PublicCloneable)
    3
    PublicCloneable pc = (PublicCloneable)this.paintScale;
    3
    PublicCloneable pc = (PublicCloneable)this.paintScale;
    3
    PublicCloneable pc = (PublicCloneable)this.underlying;
    Differences
    Expression1Expression2Difference
    paintScaleunderlyingVARIABLE_NAME_MISMATCH
    org.jfree.chart.renderer.PaintScaleorg.jfree.data.xy.XYDatasetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.renderer.PaintScale of variable this.paintScale does not match with type org.jfree.data.xy.XYDataset of variable this.underlying
    • Make classes org.jfree.chart.renderer.PaintScale and org.jfree.data.xy.XYDataset extend a common superclass
    3
    PublicCloneable pc = (PublicCloneable)this.underlying;
                                                                                        
    4
    clone.underlying = (XYDataset)pc.clone();
    Preondition Violations
    Unmatched statement clone.underlying=(XYDataset)pc.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement clone.underlying=(XYDataset)pc.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    4
    clone.underlying = (XYDataset)pc.clone();
    4
    clone.paintScale = (PaintScale)pc.clone();
    4
    clone.paintScale = (PaintScale)pc.clone();
    Preondition Violations
    Unmatched statement clone.paintScale=(PaintScale)pc.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    Unmatched statement clone.paintScale=(PaintScale)pc.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
                                                                                          
    5
    return clone;
    5
    return clone;
    5
    return clone;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.renderer.xy.XYBlockRendererorg.jfree.data.xy.XYBarDatasetSUBCLASS_TYPE_MISMATCH
    5
    return clone;
    Precondition Violations (9)
    Row Violation
    1Super method call XYBlockRenderer clone=(XYBlockRenderer)super.clone(); cannot be extracted from method
    2Super method call XYBarDataset clone=(XYBarDataset)super.clone(); cannot be extracted from method
    3Type org.jfree.chart.renderer.PaintScale of variable this.paintScale does not match with type org.jfree.data.xy.XYDataset of variable this.underlying
    4Type org.jfree.chart.renderer.PaintScale of variable this.paintScale does not match with type org.jfree.data.xy.XYDataset of variable this.underlying
    5Unmatched statement clone.underlying=(XYDataset)pc.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6Unmatched statement clone.underlying=(XYDataset)pc.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    7Unmatched statement clone.paintScale=(PaintScale)pc.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched statement clone.paintScale=(PaintScale)pc.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
    9Clone fragment #1 returns variables clone, pc , while Clone fragment #2 returns variables clone, pc