XYBlockRenderer clone = (XYBlockRenderer) super.clone(); if (this.paintScale instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.paintScale; clone.paintScale = (PaintScale) pc.clone(); } return clone;
SlidingCategoryDataset clone = (SlidingCategoryDataset) super.clone(); if (this.underlying instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.underlying; clone.underlying = (CategoryDataset) 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/category/SlidingCategoryDataset.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
SlidingCategoryDataset clone = (SlidingCategoryDataset) 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 = (CategoryDataset) 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.2
Clones locationClones are in different classes
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)1.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                
    1
    SlidingCategoryDataset clone = (SlidingCategoryDataset)super.clone();
    1
    XYBlockRenderer clone = (XYBlockRenderer)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.category.CategoryDatasetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.renderer.PaintScale of variable this.paintScale does not match with type org.jfree.data.category.CategoryDataset of variable this.underlying
    • Make classes org.jfree.chart.renderer.PaintScale and org.jfree.data.category.CategoryDataset 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.category.CategoryDatasetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.renderer.PaintScale of variable this.paintScale does not match with type org.jfree.data.category.CategoryDataset of variable this.underlying
    • Make classes org.jfree.chart.renderer.PaintScale and org.jfree.data.category.CategoryDataset extend a common superclass
    3
    PublicCloneable pc = (PublicCloneable)this.underlying;
                                                                                                    
    4
    clone.underlying = (CategoryDataset)pc.clone();
    Preondition Violations
    Unmatched statement clone.underlying=(CategoryDataset)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=(CategoryDataset)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 = (CategoryDataset)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;
    Preondition Violations
    Unmatched return clone;
    5
    return clone;
    5
    return clone;
    5
    return clone;
    Preondition Violations
    Unmatched return clone;
                                    
    Precondition Violations (8)
    Row Violation
    1Type org.jfree.chart.renderer.PaintScale of variable this.paintScale does not match with type org.jfree.data.category.CategoryDataset of variable this.underlying
    2Type org.jfree.chart.renderer.PaintScale of variable this.paintScale does not match with type org.jfree.data.category.CategoryDataset of variable this.underlying
    3Unmatched statement clone.underlying=(CategoryDataset)pc.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement clone.underlying=(CategoryDataset)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
    5Unmatched 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
    6Unmatched 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
    7Unmatched return clone;
    8Unmatched return clone;