if (this.baseItemLabelGenerator != null) { if (this.baseItemLabelGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.baseItemLabelGenerator; clone.baseItemLabelGenerator = (CategoryItemLabelGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "ItemLabelGenerator not cloneable."); } }
if (this.baseToolTipGenerator != null) { if (this.baseToolTipGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.baseToolTipGenerator; clone.baseToolTipGenerator = (CategoryToolTipGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "Base tool tip generator not cloneable."); } }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java
Method name: Object clone() Method name: Object clone()
Number of AST nodes: 5 Number of AST nodes: 5
1
if (this.baseItemLabelGenerator != null) {
1
if (this.baseToolTipGenerator != null) {
2
            if (this.baseItemLabelGenerator instanceof PublicCloneable) {
2
            if (this.baseToolTipGenerator instanceof PublicCloneable) {
3
                PublicCloneable pc
3
                PublicCloneable pc
4
                        = (PublicCloneable) this.baseItemLabelGenerator;
4
                        = (PublicCloneable) this.baseToolTipGenerator;
5
                clone.baseItemLabelGenerator
5
                clone.baseToolTipGenerator
6
                        = (CategoryItemLabelGenerator) pc.clone();
6
                        = (CategoryToolTipGenerator) pc.clone();
7
            }
7
            }
8
            else {
8
            else {
9
                throw new CloneNotSupportedException(
9
                throw new CloneNotSupportedException(
10
                        "ItemLabelGenerator not cloneable.");
10
                        "Base tool tip generator not cloneable.");
11
            }
11
            }
12
        }
12
        }
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 the same method
Number of node comparisons17
  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)2.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    9
    if (this.baseItemLabelGenerator != null)
    9
    if (this.baseItemLabelGenerator != null)
    21
    if (this.baseToolTipGenerator != null)
    Differences
    Expression1Expression2Difference
    baseItemLabelGeneratorbaseToolTipGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryItemLabelGeneratororg.jfree.chart.labels.CategoryToolTipGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.baseItemLabelGenerator does not match with type org.jfree.chart.labels.CategoryToolTipGenerator of variable this.baseToolTipGenerator
    • Make classes org.jfree.chart.labels.CategoryItemLabelGenerator and org.jfree.chart.labels.CategoryToolTipGenerator extend a common superclass
    21
    if (this.baseToolTipGenerator != null)
    10
    if (this.baseItemLabelGenerator instanceof PublicCloneable)
    10
    if (this.baseItemLabelGenerator instanceof PublicCloneable)
    22
    if (this.baseToolTipGenerator instanceof PublicCloneable)
    Differences
    Expression1Expression2Difference
    baseItemLabelGeneratorbaseToolTipGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryItemLabelGeneratororg.jfree.chart.labels.CategoryToolTipGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.baseItemLabelGenerator does not match with type org.jfree.chart.labels.CategoryToolTipGenerator of variable this.baseToolTipGenerator
    • Make classes org.jfree.chart.labels.CategoryItemLabelGenerator and org.jfree.chart.labels.CategoryToolTipGenerator extend a common superclass
    22
    if (this.baseToolTipGenerator instanceof PublicCloneable)
    11
    PublicCloneable pc = (PublicCloneable)this.baseItemLabelGenerator;
    11
    PublicCloneable pc = (PublicCloneable)this.baseItemLabelGenerator;
    23
    PublicCloneable pc = (PublicCloneable)this.baseToolTipGenerator;
    Differences
    Expression1Expression2Difference
    baseItemLabelGeneratorbaseToolTipGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryItemLabelGeneratororg.jfree.chart.labels.CategoryToolTipGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.baseItemLabelGenerator does not match with type org.jfree.chart.labels.CategoryToolTipGenerator of variable this.baseToolTipGenerator
    • Make classes org.jfree.chart.labels.CategoryItemLabelGenerator and org.jfree.chart.labels.CategoryToolTipGenerator extend a common superclass
    23
    PublicCloneable pc = (PublicCloneable)this.baseToolTipGenerator;
    12
    clone.baseItemLabelGenerator = (CategoryItemLabelGenerator)pc.clone();
    12
    clone.baseItemLabelGenerator = (CategoryItemLabelGenerator)pc.clone();
    Preondition Violations
    Unmatched statement clone.baseItemLabelGenerator=(CategoryItemLabelGenerator)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.baseItemLabelGenerator=(CategoryItemLabelGenerator)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
                                                                                                                                                    
                                                                                                                                            
    24
    clone.baseToolTipGenerator = (CategoryToolTipGenerator)pc.clone();
    Preondition Violations
    Unmatched statement clone.baseToolTipGenerator=(CategoryToolTipGenerator)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.baseToolTipGenerator=(CategoryToolTipGenerator)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
    24
    clone.baseToolTipGenerator = (CategoryToolTipGenerator)pc.clone();
    else
    else
    13
    throw new CloneNotSupportedException("ItemLabelGenerator not cloneable.");
    13
    throw new CloneNotSupportedException("ItemLabelGenerator not cloneable.");
    25
    throw new CloneNotSupportedException("Base tool tip generator not cloneable.");
    Differences
    Expression1Expression2Difference
    "ItemLabelGenerator not cloneable.""Base tool tip generator not cloneable."LITERAL_VALUE_MISMATCH
    25
    throw new CloneNotSupportedException("Base tool tip generator not cloneable.");
    Precondition Violations (7)
    Row Violation
    1Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.baseItemLabelGenerator does not match with type org.jfree.chart.labels.CategoryToolTipGenerator of variable this.baseToolTipGenerator
    2Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.baseItemLabelGenerator does not match with type org.jfree.chart.labels.CategoryToolTipGenerator of variable this.baseToolTipGenerator
    3Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.baseItemLabelGenerator does not match with type org.jfree.chart.labels.CategoryToolTipGenerator of variable this.baseToolTipGenerator
    4Unmatched statement clone.baseItemLabelGenerator=(CategoryItemLabelGenerator)pc.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Unmatched statement clone.baseItemLabelGenerator=(CategoryItemLabelGenerator)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
    6Unmatched statement clone.baseToolTipGenerator=(CategoryToolTipGenerator)pc.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement clone.baseToolTipGenerator=(CategoryToolTipGenerator)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