389-1-2

AbstractCategoryItemLabelGenerator clone = (AbstractCategoryItemLabelGenerator) super.clone(); if (this.numberFormat != null) { clone.numberFormat = (NumberFormat) this.numberFormat.clone(); } if (this.dateFormat != null) { clone.dateFormat = (DateFormat) this.dateFormat.clone(); } return clone;
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;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/labels/AbstractCategoryItemLabelGenerator.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/labels/AbstractPieItemLabelGenerator.java
Method name: `Object clone()` |  | Method name: `Object clone()`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    AbstractCategoryItemLabelGenerator clone ↵

1

    AbstractPieItemLabelGenerator clone↵

2

                = (AbstractCategoryItemLabelGenerator) super.clone();↵

2

                    = (AbstractPieItemLabelGenerator) super.clone();↵

3

            if (this.numberFormat != null) {↵

3

            if (this.numberFormat != null) {↵

4

                clone.numberFormat = (NumberFormat) this.numberFormat.clone();↵

4

                clone.numberFormat = (NumberFormat) this.numberFormat.clone();↵

5

            } ↵

5

            }↵

6

            if (this.dateFormat != null) {↵

6

            if (this.percentFormat != null) {↵

7

                clone.dateFormat = (DateFormat) this.dateFormat.clone();↵

7

                clone.percentFormat = (NumberFormat) this.percentFormat.clone();↵

8

            } ↵

8

            }↵

9

            return clone;

9

            return clone;

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3
Clones location | Clones are in different classes
Number of node comparisons | 17

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 4
   Number of unmapped statements in the first code fragment | 2
   Number of unmapped statements in the second code fragment | 2
   Time elapsed for statement mapping (ms) | 1.4
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       AbstractPieItemLabelGenerator clone = (AbstractPieItemLabelGenerator)super.clone();

   1

       AbstractCategoryItemLabelGenerator clone = (AbstractCategoryItemLabelGenerator)super.clone();

   2

       if (this.numberFormat != null)

   2

       if (this.numberFormat != null)

   3

       clone.numberFormat = (NumberFormat)this.numberFormat.clone();

   3 | clone.numberFormat = (NumberFormat)this.numberFormat.clone();
   3 | clone.numberFormat = (NumberFormat)this.numberFormat.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.labels.AbstractCategoryItemLabelGenerator | org.jfree.chart.labels.AbstractPieItemLabelGenerator | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.labels.AbstractCategoryItemLabelGenerator of variable clone does not match with type org.jfree.chart.labels.AbstractPieItemLabelGenerator of variable clone
   - Make classes org.jfree.chart.labels.AbstractCategoryItemLabelGenerator and org.jfree.chart.labels.AbstractPieItemLabelGenerator extend a common superclass

   3

       clone.numberFormat = (NumberFormat)this.numberFormat.clone();

   4

       if (this.dateFormat != null)

   4 | if (this.dateFormat != null)
   4 | if (this.percentFormat != null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   dateFormat | percentFormat | VARIABLE_NAME_MISMATCH

   4

       if (this.percentFormat != null)

   5

       clone.dateFormat = (DateFormat)this.dateFormat.clone();

   5 | clone.dateFormat = (DateFormat)this.dateFormat.clone();
   5 | clone.percentFormat = (NumberFormat)this.percentFormat.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.labels.AbstractCategoryItemLabelGenerator | org.jfree.chart.labels.AbstractPieItemLabelGenerator | VARIABLE_TYPE_MISMATCH
   dateFormat | percentFormat | VARIABLE_NAME_MISMATCH
   java.text.DateFormat | java.text.NumberFormat | SUBCLASS_TYPE_MISMATCH
   dateFormat | percentFormat | VARIABLE_NAME_MISMATCH

   Preondition Violations

   Type org.jfree.chart.labels.AbstractCategoryItemLabelGenerator of variable clone does not match with type org.jfree.chart.labels.AbstractPieItemLabelGenerator of variable clone
   - Make classes org.jfree.chart.labels.AbstractCategoryItemLabelGenerator and org.jfree.chart.labels.AbstractPieItemLabelGenerator extend a common superclass

   5

       clone.percentFormat = (NumberFormat)this.percentFormat.clone();

   6 | return clone;

   Preondition Violations
   Unmatched return clone;

   6

       return clone;

   6

       return clone;

   6 | return clone;

   Preondition Violations
   Unmatched return clone;

   Precondition Violations (4)
   Row | Violation
   --- | ---
   1 | Type org.jfree.chart.labels.AbstractCategoryItemLabelGenerator of variable clone does not match with type org.jfree.chart.labels.AbstractPieItemLabelGenerator of variable clone
   2 | Type org.jfree.chart.labels.AbstractCategoryItemLabelGenerator of variable clone does not match with type org.jfree.chart.labels.AbstractPieItemLabelGenerator of variable clone
   3 | Unmatched return clone;
   4 | Unmatched return clone;