AbstractPieItemLabelGenerator clone = (AbstractPieItemLabelGenerator) super.clone(); if (this.numberFormat != null) { clone.numberFormat = (NumberFormat) this.numberFormat.clone(); } if (this.percentFormat != null) { clone.percentFormat = (NumberFormat) this.percentFormat.clone(); } return clone;
HighLowItemLabelGenerator clone = (HighLowItemLabelGenerator) super.clone(); if (this.dateFormatter != null) { clone.dateFormatter = (DateFormat) this.dateFormatter.clone(); } if (this.numberFormatter != null) { clone.numberFormatter = (NumberFormat) this.numberFormatter.clone(); } return clone;
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/labels/AbstractPieItemLabelGenerator.java File path: /jfreechart-1.0.10/src/org/jfree/chart/labels/HighLowItemLabelGenerator.java
Method name: Object clone() Method name: Object clone()
Number of AST nodes: 6 Number of AST nodes: 6
1
AbstractPieItemLabelGenerator clone
1
HighLowItemLabelGenerator clone 
2
                = (AbstractPieItemLabelGenerator) super.clone();
2
            = (HighLowItemLabelGenerator) super.clone();
3
        if (this.numberFormat != null) {
3
        if (this.dateFormatter != null) {
4
            clone.numberFormat = (NumberFormat) this.numberFormat.clone();
4
            clone.dateFormatter = (DateFormat) this.dateFormatter.clone();
5
        }
5
        }
6
        if (this.percentFormat != null) {
6
        if (this.numberFormatter != null) {
7
            clone.percentFormat = (NumberFormat) this.percentFormat.clone();
7
            clone.numberFormatter = (NumberFormat) this.numberFormatter.clone();
8
        }
8
        }
9
        
9
        return clone;
10
        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.4
Clones locationClones are in different classes
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)3.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
                                                                                                                                                            
    1
    HighLowItemLabelGenerator clone = (HighLowItemLabelGenerator)super.clone();
    1
    AbstractPieItemLabelGenerator clone = (AbstractPieItemLabelGenerator)super.clone();
                                                                                                                                                                            
    2
    if (this.numberFormat != null)
    2
    if (this.numberFormat != null)
    4
    if (this.numberFormatter != null)
    Differences
    Expression1Expression2Difference
    numberFormatnumberFormatterVARIABLE_NAME_MISMATCH
    4
    if (this.numberFormatter != null)
    3
    clone.numberFormat = (NumberFormat)this.numberFormat.clone();
    3
    clone.numberFormat = (NumberFormat)this.numberFormat.clone();
    5
    clone.numberFormatter = (NumberFormat)this.numberFormatter.clone();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.labels.AbstractPieItemLabelGeneratororg.jfree.chart.labels.HighLowItemLabelGeneratorVARIABLE_TYPE_MISMATCH
    numberFormatnumberFormatterVARIABLE_NAME_MISMATCH
    numberFormatnumberFormatterVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type java.text.NumberFormat of variable clone.numberFormat does not match with type java.text.NumberFormat of variable clone.numberFormatter
    • Make classes org.jfree.chart.labels.AbstractPieItemLabelGenerator and org.jfree.chart.labels.HighLowItemLabelGenerator extend a common superclass
    Expression clone.numberFormat cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression clone.numberFormatter cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression clone.numberFormat is a field being modified, and thus it cannot be parameterized
    Expression clone.numberFormatter is a field being modified, and thus it cannot be parameterized
    5
    clone.numberFormatter = (NumberFormat)this.numberFormatter.clone();
    4
    if (this.percentFormat != null)
    4
    if (this.percentFormat != null)
    2
    if (this.dateFormatter != null)
    Differences
    Expression1Expression2Difference
    percentFormatdateFormatterVARIABLE_NAME_MISMATCH
    java.text.NumberFormatjava.text.DateFormatSUBCLASS_TYPE_MISMATCH
    2
    if (this.dateFormatter != null)
    5
    clone.percentFormat = (NumberFormat)this.percentFormat.clone();
    5
    clone.percentFormat = (NumberFormat)this.percentFormat.clone();
    3
    clone.dateFormatter = (DateFormat)this.dateFormatter.clone();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.labels.AbstractPieItemLabelGeneratororg.jfree.chart.labels.HighLowItemLabelGeneratorVARIABLE_TYPE_MISMATCH
    percentFormatdateFormatterVARIABLE_NAME_MISMATCH
    java.text.NumberFormatjava.text.DateFormatSUBCLASS_TYPE_MISMATCH
    java.text.NumberFormatjava.text.DateFormatSUBCLASS_TYPE_MISMATCH
    percentFormatdateFormatterVARIABLE_NAME_MISMATCH
    java.text.NumberFormatjava.text.DateFormatSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type java.text.NumberFormat of variable clone.percentFormat does not match with type java.text.DateFormat of variable clone.dateFormatter
    • Make classes org.jfree.chart.labels.AbstractPieItemLabelGenerator and org.jfree.chart.labels.HighLowItemLabelGenerator extend a common superclass
    Expression clone.percentFormat cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression clone.dateFormatter cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression clone.percentFormat is a field being modified, and thus it cannot be parameterized
    Expression clone.dateFormatter is a field being modified, and thus it cannot be parameterized
    Expression (NumberFormat)this.percentFormat.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (DateFormat)this.dateFormatter.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    clone.dateFormatter = (DateFormat)this.dateFormatter.clone();
                                    
    6
    return clone;
    6
    return clone;
                                    
    Precondition Violations (12)
    Row Violation
    1Type java.text.NumberFormat of variable clone.numberFormat does not match with type java.text.NumberFormat of variable clone.numberFormatter
    2Expression clone.numberFormat cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression clone.numberFormatter cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression clone.numberFormat is a field being modified, and thus it cannot be parameterized
    5Expression clone.numberFormatter is a field being modified, and thus it cannot be parameterized
    6Type java.text.NumberFormat of variable clone.percentFormat does not match with type java.text.DateFormat of variable clone.dateFormatter
    7Expression clone.percentFormat cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression clone.dateFormatter cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression clone.percentFormat is a field being modified, and thus it cannot be parameterized
    10Expression clone.dateFormatter is a field being modified, and thus it cannot be parameterized
    11Expression (NumberFormat)this.percentFormat.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression (DateFormat)this.dateFormatter.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted