ChartRenderingInfo clone = (ChartRenderingInfo) super.clone(); if (this.chartArea != null) { clone.chartArea = (Rectangle2D) this.chartArea.clone(); } if (this.entities instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.entities; clone.entities = (EntityCollection) pc.clone(); } return clone;
Plot clone = (Plot) super.clone(); // private Plot parent <-- don't clone the parent plot, but take care // childs in combined plots instead if (this.datasetGroup != null) { clone.datasetGroup = (DatasetGroup) ObjectUtilities.clone(this.datasetGroup); } clone.drawingSupplier = (DrawingSupplier) ObjectUtilities.clone(this.drawingSupplier); clone.listenerList = new EventListenerList(); return clone;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/ChartRenderingInfo.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/Plot.java
Method name: Object clone() Method name: Object clone()
Number of AST nodes: 7 Number of AST nodes: 6
1
ChartRenderingInfo clone = (ChartRenderingInfo) super.clone();
1
Plot clone = (Plot) super.clone();
2
        // private Plot parent <-- don't clone the parent plot, but take care
3
        // childs in combined plots instead
2
        if (this.chartArea != null) {
4
        if (this.datasetGroup != null) {
3
            clone.chartArea = (Rectangle2D) this.chartArea.clone();
5
            clone.
4
        }
5
        if (this.entities instanceof PublicCloneable) {
6
            PublicCloneable pc = (PublicCloneable) this.entities;
7
            clone.entities = (EntityCollection) pc.clone();
8
        }
6
datasetGroup
7
                = (DatasetGroup) ObjectUtilities.clone(this.datasetGroup);
8
        }
9
        clone.drawingSupplier
10
            = (DrawingSupplier) ObjectUtilities.clone(this.drawingSupplier);
11
        clone.listenerList = new EventListenerList();
9
        return clone;
12
        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.5
Clones locationClones are in different classes
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment5
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                        
    1
    Plot clone = (Plot)super.clone();
    1
    ChartRenderingInfo clone = (ChartRenderingInfo)super.clone();
                                                                                                                                
    2
    if (this.chartArea != null)
    2
    if (this.chartArea != null)
    2
    if (this.datasetGroup != null)
    Differences
    Expression1Expression2Difference
    chartAreadatasetGroupVARIABLE_NAME_MISMATCH
    java.awt.geom.Rectangle2Dorg.jfree.data.general.DatasetGroupVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.geom.Rectangle2D of variable this.chartArea does not match with type org.jfree.data.general.DatasetGroup of variable this.datasetGroup
    • Make classes java.awt.geom.Rectangle2D and org.jfree.data.general.DatasetGroup extend a common superclass
    2
    if (this.datasetGroup != null)
                                                                                                                                                              
    3
    clone.datasetGroup = (DatasetGroup)ObjectUtilities.clone(this.datasetGroup);
    Preondition Violations
    Unmatched statement clone.datasetGroup=(DatasetGroup)ObjectUtilities.clone(this.datasetGroup); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement clone.datasetGroup=(DatasetGroup)ObjectUtilities.clone(this.datasetGroup); 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
    3
    clone.datasetGroup = (DatasetGroup)ObjectUtilities.clone(this.datasetGroup);
    3
    clone.chartArea = (Rectangle2D)this.chartArea.clone();
    3
    clone.chartArea = (Rectangle2D)this.chartArea.clone();
    Preondition Violations
    Unmatched statement clone.chartArea=(Rectangle2D)this.chartArea.clone(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                                                  
                                                                                                                                                                                
    4
    clone.drawingSupplier = (DrawingSupplier)ObjectUtilities.clone(this.drawingSupplier);
    Preondition Violations
    Unmatched statement clone.drawingSupplier=(DrawingSupplier)ObjectUtilities.clone(this.drawingSupplier); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    clone.drawingSupplier = (DrawingSupplier)ObjectUtilities.clone(this.drawingSupplier);
                                                                                                
    5
    clone.listenerList = new EventListenerList();
    Preondition Violations
    Unmatched statement clone.listenerList=new EventListenerList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5
    clone.listenerList = new EventListenerList();
                                    
    6
    return clone;
    Preondition Violations
    Unmatched return clone;
    6
    return clone;
    7
    return clone;
    7
    return clone;
    Preondition Violations
    Unmatched return clone;
                                    
    Precondition Violations (9)
    Row Violation
    1Type java.awt.geom.Rectangle2D of variable this.chartArea does not match with type org.jfree.data.general.DatasetGroup of variable this.datasetGroup
    2Unmatched statement clone.datasetGroup=(DatasetGroup)ObjectUtilities.clone(this.datasetGroup); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    3Unmatched statement clone.datasetGroup=(DatasetGroup)ObjectUtilities.clone(this.datasetGroup); 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
    4Unmatched statement clone.chartArea=(Rectangle2D)this.chartArea.clone(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement clone.drawingSupplier=(DrawingSupplier)ObjectUtilities.clone(this.drawingSupplier); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement clone.listenerList=new EventListenerList(); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7Unmatched return clone;
    8Unmatched return clone;
    9The refactoring of the clones is infeasible, because the number of macthed statements is equal to zero