if (this.itemLabelGenerator != null) { if (this.itemLabelGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.itemLabelGenerator; clone.itemLabelGenerator = (CategoryItemLabelGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "ItemLabelGenerator not cloneable."); } }
if (this.baseItemURLGenerator != null) { if (this.baseItemURLGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.baseItemURLGenerator; clone.baseItemURLGenerator = (CategoryURLGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "Base item URL 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.itemLabelGenerator != null) {
1
if (this.baseItemURLGenerator != null) {
2
            if (this.itemLabelGenerator instanceof PublicCloneable) {
2
            if (this.baseItemURLGenerator instanceof PublicCloneable) {
3
                PublicCloneable pc
3
                PublicCloneable pc
4
 = (PublicCloneable) this.itemLabelGenerator;
4
                        = (PublicCloneable) this.baseItemURLGenerator;
5
                clone.itemLabelGenerator
5
                clone.
6
                        = (CategoryItemLabelGenerator) pc.clone();
6
baseItemURLGenerator = (CategoryURLGenerator) pc.clone();
7
            }
7
            }
8
            else {
8
            else {
9
                throw new CloneNotSupportedException(
9
                throw new CloneNotSupportedException(
10
                        "ItemLabelGenerator not cloneable.");
10
                        "Base item URL 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.3
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
    2
    if (this.itemLabelGenerator != null)
    2
    if (this.itemLabelGenerator != null)
    33
    if (this.baseItemURLGenerator != null)
    Differences
    Expression1Expression2Difference
    itemLabelGeneratorbaseItemURLGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryItemLabelGeneratororg.jfree.chart.urls.CategoryURLGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.itemLabelGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.baseItemURLGenerator
    • Make classes org.jfree.chart.labels.CategoryItemLabelGenerator and org.jfree.chart.urls.CategoryURLGenerator extend a common superclass
    33
    if (this.baseItemURLGenerator != null)
    3
    if (this.itemLabelGenerator instanceof PublicCloneable)
    3
    if (this.itemLabelGenerator instanceof PublicCloneable)
    34
    if (this.baseItemURLGenerator instanceof PublicCloneable)
    Differences
    Expression1Expression2Difference
    itemLabelGeneratorbaseItemURLGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryItemLabelGeneratororg.jfree.chart.urls.CategoryURLGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.itemLabelGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.baseItemURLGenerator
    • Make classes org.jfree.chart.labels.CategoryItemLabelGenerator and org.jfree.chart.urls.CategoryURLGenerator extend a common superclass
    34
    if (this.baseItemURLGenerator instanceof PublicCloneable)
    4
    PublicCloneable pc = (PublicCloneable)this.itemLabelGenerator;
    4
    PublicCloneable pc = (PublicCloneable)this.itemLabelGenerator;
    35
    PublicCloneable pc = (PublicCloneable)this.baseItemURLGenerator;
    Differences
    Expression1Expression2Difference
    itemLabelGeneratorbaseItemURLGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryItemLabelGeneratororg.jfree.chart.urls.CategoryURLGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.itemLabelGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.baseItemURLGenerator
    • Make classes org.jfree.chart.labels.CategoryItemLabelGenerator and org.jfree.chart.urls.CategoryURLGenerator extend a common superclass
    35
    PublicCloneable pc = (PublicCloneable)this.baseItemURLGenerator;
    5
    clone.itemLabelGenerator = (CategoryItemLabelGenerator)pc.clone();
    5
    clone.itemLabelGenerator = (CategoryItemLabelGenerator)pc.clone();
    Preondition Violations
    Unmatched statement clone.itemLabelGenerator=(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.itemLabelGenerator=(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
                                                                                                                                          
                                                                                                                                    
    36
    clone.baseItemURLGenerator = (CategoryURLGenerator)pc.clone();
    Preondition Violations
    Unmatched statement clone.baseItemURLGenerator=(CategoryURLGenerator)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.baseItemURLGenerator=(CategoryURLGenerator)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
    36
    clone.baseItemURLGenerator = (CategoryURLGenerator)pc.clone();
    else
    else
    6
    throw new CloneNotSupportedException("ItemLabelGenerator not cloneable.");
    6
    throw new CloneNotSupportedException("ItemLabelGenerator not cloneable.");
    37
    throw new CloneNotSupportedException("Base item URL generator not cloneable.");
    Differences
    Expression1Expression2Difference
    "ItemLabelGenerator not cloneable.""Base item URL generator not cloneable."LITERAL_VALUE_MISMATCH
    37
    throw new CloneNotSupportedException("Base item URL generator not cloneable.");
    Precondition Violations (7)
    Row Violation
    1Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.itemLabelGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.baseItemURLGenerator
    2Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.itemLabelGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.baseItemURLGenerator
    3Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.itemLabelGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.baseItemURLGenerator
    4Unmatched statement clone.itemLabelGenerator=(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.itemLabelGenerator=(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.baseItemURLGenerator=(CategoryURLGenerator)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.baseItemURLGenerator=(CategoryURLGenerator)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