if (this.toolTipGenerator != null) { if (this.toolTipGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.toolTipGenerator; clone.toolTipGenerator = (CategoryToolTipGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "Tool tip generator 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.toolTipGenerator != null) {
1
if (this.itemURLGenerator != null) {
2
            if (this.toolTipGenerator instanceof PublicCloneable) {
2
            if (this.itemURLGenerator instanceof PublicCloneable) {
3
                PublicCloneable pc = (PublicCloneable) this.toolTipGenerator;
3
                PublicCloneable pc = (PublicCloneable) this.itemURLGenerator;
4
                clone.toolTipGenerator = (CategoryToolTipGenerator) pc.clone();
4
                clone.itemURLGenerator = (CategoryURLGenerator) pc.clone();
5
            }
5
            }
6
            else {
6
            else {
7
                throw new CloneNotSupportedException(
7
                throw new CloneNotSupportedException(
8
                        "Tool tip generator not cloneable.");
8
                        "Item URL generator not cloneable.");
9
            }
9
            }
10
        }
10
        }
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
    14
    if (this.toolTipGenerator != null)
    14
    if (this.toolTipGenerator != null)
    26
    if (this.itemURLGenerator != null)
    Differences
    Expression1Expression2Difference
    toolTipGeneratoritemURLGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryToolTipGeneratororg.jfree.chart.urls.CategoryURLGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryToolTipGenerator of variable this.toolTipGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.itemURLGenerator
    • Make classes org.jfree.chart.labels.CategoryToolTipGenerator and org.jfree.chart.urls.CategoryURLGenerator extend a common superclass
    26
    if (this.itemURLGenerator != null)
    15
    if (this.toolTipGenerator instanceof PublicCloneable)
    15
    if (this.toolTipGenerator instanceof PublicCloneable)
    27
    if (this.itemURLGenerator instanceof PublicCloneable)
    Differences
    Expression1Expression2Difference
    toolTipGeneratoritemURLGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryToolTipGeneratororg.jfree.chart.urls.CategoryURLGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryToolTipGenerator of variable this.toolTipGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.itemURLGenerator
    • Make classes org.jfree.chart.labels.CategoryToolTipGenerator and org.jfree.chart.urls.CategoryURLGenerator extend a common superclass
    27
    if (this.itemURLGenerator instanceof PublicCloneable)
    16
    PublicCloneable pc = (PublicCloneable)this.toolTipGenerator;
    16
    PublicCloneable pc = (PublicCloneable)this.toolTipGenerator;
    28
    PublicCloneable pc = (PublicCloneable)this.itemURLGenerator;
    Differences
    Expression1Expression2Difference
    toolTipGeneratoritemURLGeneratorVARIABLE_NAME_MISMATCH
    org.jfree.chart.labels.CategoryToolTipGeneratororg.jfree.chart.urls.CategoryURLGeneratorVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.jfree.chart.labels.CategoryToolTipGenerator of variable this.toolTipGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.itemURLGenerator
    • Make classes org.jfree.chart.labels.CategoryToolTipGenerator and org.jfree.chart.urls.CategoryURLGenerator extend a common superclass
    28
    PublicCloneable pc = (PublicCloneable)this.itemURLGenerator;
    17
    clone.toolTipGenerator = (CategoryToolTipGenerator)pc.clone();
    17
    clone.toolTipGenerator = (CategoryToolTipGenerator)pc.clone();
    Preondition Violations
    Unmatched statement clone.toolTipGenerator=(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.toolTipGenerator=(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
                                                                                                                                    
                                                                                                                            
    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
    18
    throw new CloneNotSupportedException("Tool tip generator not cloneable.");
    18
    throw new CloneNotSupportedException("Tool tip generator not cloneable.");
    30
    throw new CloneNotSupportedException("Item URL generator not cloneable.");
    Differences
    Expression1Expression2Difference
    "Tool tip generator 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.CategoryToolTipGenerator of variable this.toolTipGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.itemURLGenerator
    2Type org.jfree.chart.labels.CategoryToolTipGenerator of variable this.toolTipGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.itemURLGenerator
    3Type org.jfree.chart.labels.CategoryToolTipGenerator of variable this.toolTipGenerator does not match with type org.jfree.chart.urls.CategoryURLGenerator of variable this.itemURLGenerator
    4Unmatched statement clone.toolTipGenerator=(CategoryToolTipGenerator)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.toolTipGenerator=(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
    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