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.itemURLGenerator != null) { if (this.itemURLGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.itemURLGenerator; clone.itemURLGenerator = (CategoryURLGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "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.baseItemLabelGenerator != null) {
1
if (this.itemURLGenerator != null) {
2
            if (this.baseItemLabelGenerator instanceof PublicCloneable) {
2
            if (this.itemURLGenerator instanceof PublicCloneable) {
3
                PublicCloneable pc
3
                PublicCloneable pc
4
                        = (PublicCloneable) this.baseItemLabelGenerator;
4
 = (PublicCloneable) this.itemURLGenerator;
5
                clone.baseItemLabelGenerator
5
                clone.
6
                        = (CategoryItemLabelGenerator) pc.clone();
6
itemURLGenerator = (CategoryURLGenerator) pc.clone();
7
            }
7
            }
8
            else {
8
            else {
9
                throw new CloneNotSupportedException(
9
                throw new CloneNotSupportedException(
10
                        "ItemLabelGenerator not cloneable.");
10
                        "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.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    9
    if (this.baseItemLabelGenerator != null)
    9
    if (this.baseItemLabelGenerator != null)
    26
    if (this.itemURLGenerator != null)
    Differences
    Expression1Expression2Difference
    baseItemLabelGeneratoritemURLGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryItemLabelGeneratororg.jfree.chart.urls.CategoryURLGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.baseItemLabelGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.itemURLGenerator
    • Make classes org.jfree.chart.labels.CategoryItemLabelGenerator and org.jfree.chart.urls.CategoryURLGenerator extend a common superclass
    26
    if (this.itemURLGenerator != null)
    10
    if (this.baseItemLabelGenerator instanceof PublicCloneable)
    10
    if (this.baseItemLabelGenerator instanceof PublicCloneable)
    27
    if (this.itemURLGenerator instanceof PublicCloneable)
    Differences
    Expression1Expression2Difference
    baseItemLabelGeneratoritemURLGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryItemLabelGeneratororg.jfree.chart.urls.CategoryURLGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.baseItemLabelGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.itemURLGenerator
    • Make classes org.jfree.chart.labels.CategoryItemLabelGenerator and org.jfree.chart.urls.CategoryURLGenerator extend a common superclass
    27
    if (this.itemURLGenerator instanceof PublicCloneable)
    11
    PublicCloneable pc = (PublicCloneable)this.baseItemLabelGenerator;
    11
    PublicCloneable pc = (PublicCloneable)this.baseItemLabelGenerator;
    28
    PublicCloneable pc = (PublicCloneable)this.itemURLGenerator;
    Differences
    Expression1Expression2Difference
    baseItemLabelGeneratoritemURLGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryItemLabelGeneratororg.jfree.chart.urls.CategoryURLGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.baseItemLabelGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.itemURLGenerator
    • Make classes org.jfree.chart.labels.CategoryItemLabelGenerator and org.jfree.chart.urls.CategoryURLGenerator extend a common superclass
    28
    PublicCloneable pc = (PublicCloneable)this.itemURLGenerator;
    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
                                                                                                                                                    
                                                                                                                            
    29
    clone.itemURLGenerator = (CategoryURLGenerator)pc.clone();
    Preondition Violations
    Unmatched statement clone.itemURLGenerator=(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.itemURLGenerator=(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
    29
    clone.itemURLGenerator = (CategoryURLGenerator)pc.clone();
    else
    else
    13
    throw new CloneNotSupportedException("ItemLabelGenerator not cloneable.");
    13
    throw new CloneNotSupportedException("ItemLabelGenerator not cloneable.");
    30
    throw new CloneNotSupportedException("Item URL generator not cloneable.");
    Differences
    Expression1Expression2Difference
    "ItemLabelGenerator not cloneable.""Item URL generator not cloneable."LITERAL_VALUE_MISMATCH
    30
    throw new CloneNotSupportedException("Item URL 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.urls.CategoryURLGenerator of variable this.itemURLGenerator
    2Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.baseItemLabelGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.itemURLGenerator
    3Type org.jfree.chart.labels.CategoryItemLabelGenerator of variable this.baseItemLabelGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.itemURLGenerator
    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.itemURLGenerator=(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.itemURLGenerator=(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