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."); } }
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.itemURLGenerator != null) {
1
if (this.baseItemURLGenerator != null) {
2
            if (this.itemURLGenerator instanceof PublicCloneable) {
2
            if (this.baseItemURLGenerator instanceof PublicCloneable) {
3
                PublicCloneable pc
3
                PublicCloneable pc
4
 = (PublicCloneable) this.itemURLGenerator;
4
                        = (PublicCloneable) this.baseItemURLGenerator;
5
                clone.itemURLGenerator = (CategoryURLGenerator) pc.clone();
5
                clone.baseItemURLGenerator = (CategoryURLGenerator) pc.clone();
6
            }
6
            }
7
            else {
7
            else {
8
                throw new CloneNotSupportedException(
8
                throw new CloneNotSupportedException(
9
                        "Item URL generator not cloneable.");
9
                        "Base item URL generator not cloneable.");
10
            }
10
            }
11
        }
11
        }
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 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
    26
    if (this.itemURLGenerator != null)
    26
    if (this.itemURLGenerator != null)
    33
    if (this.baseItemURLGenerator != null)
    Differences
    Expression1Expression2Difference
    itemURLGeneratorbaseItemURLGeneratorVARIABLE_NAME_MISMATCH
    33
    if (this.baseItemURLGenerator != null)
    27
    if (this.itemURLGenerator instanceof PublicCloneable)
    27
    if (this.itemURLGenerator instanceof PublicCloneable)
    34
    if (this.baseItemURLGenerator instanceof PublicCloneable)
    Differences
    Expression1Expression2Difference
    itemURLGeneratorbaseItemURLGeneratorVARIABLE_NAME_MISMATCH
    34
    if (this.baseItemURLGenerator instanceof PublicCloneable)
    28
    PublicCloneable pc = (PublicCloneable)this.itemURLGenerator;
    28
    PublicCloneable pc = (PublicCloneable)this.itemURLGenerator;
    35
    PublicCloneable pc = (PublicCloneable)this.baseItemURLGenerator;
    Differences
    Expression1Expression2Difference
    itemURLGeneratorbaseItemURLGeneratorVARIABLE_NAME_MISMATCH
    35
    PublicCloneable pc = (PublicCloneable)this.baseItemURLGenerator;
    29
    clone.itemURLGenerator = (CategoryURLGenerator)pc.clone();
    29
    clone.itemURLGenerator = (CategoryURLGenerator)pc.clone();
    36
    clone.baseItemURLGenerator = (CategoryURLGenerator)pc.clone();
    Differences
    Expression1Expression2Difference
    itemURLGeneratorbaseItemURLGeneratorVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression clone.itemURLGenerator is a field being modified, and thus it cannot be parameterized
    Expression clone.baseItemURLGenerator is a field being modified, and thus it cannot be parameterized
    36
    clone.baseItemURLGenerator = (CategoryURLGenerator)pc.clone();
    else
    else
    30
    throw new CloneNotSupportedException("Item URL generator not cloneable.");
    30
    throw new CloneNotSupportedException("Item URL generator not cloneable.");
    37
    throw new CloneNotSupportedException("Base item URL generator not cloneable.");
    Differences
    Expression1Expression2Difference
    "Item URL generator not cloneable.""Base item URL generator not cloneable."LITERAL_VALUE_MISMATCH
    37
    throw new CloneNotSupportedException("Base item URL generator not cloneable.");
    Precondition Violations (2)
    Row Violation
    1Expression clone.itemURLGenerator is a field being modified, and thus it cannot be parameterized
    2Expression clone.baseItemURLGenerator is a field being modified, and thus it cannot be parameterized