if (font == null) { throw new IllegalArgumentException("Null 'font' argument."); } if (!this.font.equals(font)) { this.font = font; notifyListeners(new TitleChangeEvent(this)); }
if (paint == null) { throw new IllegalArgumentException("Null 'paint' argument."); } if (!this.paint.equals(paint)) { this.paint = paint; notifyListeners(new TitleChangeEvent(this)); }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/title/TextTitle.java File path: /jfreechart-1.0.10/src/org/jfree/chart/title/TextTitle.java
Method name: void setFont(Font) Method name: void setPaint(Paint)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (font == null) {
1
if (paint == null) {
2
            throw new IllegalArgumentException("Null 'font' argument.");
2
            throw new IllegalArgumentException("Null 'paint' argument.");
3
        }
3
        }
4
        if (!this.font.equals(font)) {
4
        if (!this.paint.equals(paint)) {
5
            this.font = font;
5
            this.paint = paint;
6
            notifyListeners(new TitleChangeEvent(this));
6
            notifyListeners(new TitleChangeEvent(this));
7
        }
7
        }
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 declared in the same class
Number of node comparisons15
  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)7.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (font == null)
    1
    if (font == null)
    1
    if (paint == null)
    Differences
    Expression1Expression2Difference
    fontpaintVARIABLE_NAME_MISMATCH
    java.awt.Fontjava.awt.PaintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Font of variable font does not match with type java.awt.Paint of variable paint
    • Make classes java.awt.Font and java.awt.Paint extend a common superclass
    1
    if (paint == null)
    2
    throw new IllegalArgumentException("Null 'font' argument.");
    2
    throw new IllegalArgumentException("Null 'font' argument.");
    2
    throw new IllegalArgumentException("Null 'paint' argument.");
    Differences
    Expression1Expression2Difference
    "Null 'font' argument.""Null 'paint' argument."LITERAL_VALUE_MISMATCH
    2
    throw new IllegalArgumentException("Null 'paint' argument.");
    3
    if (!this.font.equals(font))
    3
    if (!this.font.equals(font))
    3
    if (!this.paint.equals(paint))
    Differences
    Expression1Expression2Difference
    fontpaintVARIABLE_NAME_MISMATCH
    java.awt.Fontjava.awt.PaintVARIABLE_TYPE_MISMATCH
    fontpaintVARIABLE_NAME_MISMATCH
    java.awt.Fontjava.awt.PaintVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Font of variable font does not match with type java.awt.Paint of variable paint
    • Make classes java.awt.Font and java.awt.Paint extend a common superclass
    Type java.awt.Font of variable this.font does not match with type java.awt.Paint of variable this.paint
    • Make classes java.awt.Font and java.awt.Paint extend a common superclass
    3
    if (!this.paint.equals(paint))
                                            
    4
    this.paint = paint;
    Preondition Violations
    Unmatched statement this.paint=paint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    4
    this.paint = paint;
    4
    this.font = font;
    4
    this.font = font;
    Preondition Violations
    Unmatched statement this.font=font; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                        
    5
    notifyListeners(new TitleChangeEvent(this));
    5
    notifyListeners(new TitleChangeEvent(this));
    Precondition Violations (5)
    Row Violation
    1Type java.awt.Font of variable font does not match with type java.awt.Paint of variable paint
    2Type java.awt.Font of variable font does not match with type java.awt.Paint of variable paint
    3Type java.awt.Font of variable this.font does not match with type java.awt.Paint of variable this.paint
    4Unmatched statement this.paint=paint; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched statement this.font=font; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted