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.baseItemLabelGenerator != null) { if (this.baseItemLabelGenerator instanceof PublicCloneable) { PublicCloneable pc = (PublicCloneable) this.baseItemLabelGenerator; clone.baseItemLabelGenerator = (CategoryItemLabelGenerator) pc.clone(); } else { throw new CloneNotSupportedException( "ItemLabelGenerator 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.baseItemLabelGenerator != null) {
2
            if (this.itemLabelGenerator instanceof PublicCloneable) {
2
            if (this.baseItemLabelGenerator instanceof PublicCloneable) {
3
                PublicCloneable pc
3
                PublicCloneable pc
4
 = (PublicCloneable) this.itemLabelGenerator;
4
                        = (PublicCloneable) this.baseItemLabelGenerator;
5
                clone.itemLabelGenerator
5
                clone.baseItemLabelGenerator
6
                        = (CategoryItemLabelGenerator) pc.clone();
6
                        = (CategoryItemLabelGenerator) pc.clone();
7
            }
7
            }
8
            else {
8
            else {
9
                throw new CloneNotSupportedException(
9
                throw new CloneNotSupportedException(
10
                        "ItemLabelGenerator not cloneable.");
10
                        "ItemLabelGenerator 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.4
Clones locationClones are in the same method
Number of node comparisons17
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (this.itemLabelGenerator != null)
    2
    if (this.itemLabelGenerator != null)
    9
    if (this.baseItemLabelGenerator != null)
    Differences
    Expression1Expression2Difference
    itemLabelGeneratorbaseItemLabelGeneratorVARIABLE_NAME_MISMATCH
    9
    if (this.baseItemLabelGenerator != null)
    3
    if (this.itemLabelGenerator instanceof PublicCloneable)
    3
    if (this.itemLabelGenerator instanceof PublicCloneable)
    10
    if (this.baseItemLabelGenerator instanceof PublicCloneable)
    Differences
    Expression1Expression2Difference
    itemLabelGeneratorbaseItemLabelGeneratorVARIABLE_NAME_MISMATCH
    10
    if (this.baseItemLabelGenerator instanceof PublicCloneable)
    4
    PublicCloneable pc = (PublicCloneable)this.itemLabelGenerator;
    4
    PublicCloneable pc = (PublicCloneable)this.itemLabelGenerator;
    11
    PublicCloneable pc = (PublicCloneable)this.baseItemLabelGenerator;
    Differences
    Expression1Expression2Difference
    itemLabelGeneratorbaseItemLabelGeneratorVARIABLE_NAME_MISMATCH
    11
    PublicCloneable pc = (PublicCloneable)this.baseItemLabelGenerator;
    5
    clone.itemLabelGenerator = (CategoryItemLabelGenerator)pc.clone();
    5
    clone.itemLabelGenerator = (CategoryItemLabelGenerator)pc.clone();
    12
    clone.baseItemLabelGenerator = (CategoryItemLabelGenerator)pc.clone();
    Differences
    Expression1Expression2Difference
    itemLabelGeneratorbaseItemLabelGeneratorVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression clone.itemLabelGenerator is a field being modified, and thus it cannot be parameterized
    Expression clone.baseItemLabelGenerator is a field being modified, and thus it cannot be parameterized
    12
    clone.baseItemLabelGenerator = (CategoryItemLabelGenerator)pc.clone();
    else
    else
    6
    throw new CloneNotSupportedException("ItemLabelGenerator not cloneable.");
    13
    throw new CloneNotSupportedException("ItemLabelGenerator not cloneable.");
    Precondition Violations (2)
    Row Violation
    1Expression clone.itemLabelGenerator is a field being modified, and thus it cannot be parameterized
    2Expression clone.baseItemLabelGenerator is a field being modified, and thus it cannot be parameterized