1254-2-4

if (font == null) { throw new IllegalArgumentException("Null 'font' argument."); } if (!this.tickLabelFont.equals(font)) { this.tickLabelFont = font; notifyListeners(new AxisChangeEvent(this)); }
if (stroke == null) { throw new IllegalArgumentException("Null 'stroke' argument."); } if (!this.tickMarkStroke.equals(stroke)) { this.tickMarkStroke = stroke; notifyListeners(new AxisChangeEvent(this)); }

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/Axis.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/axis/Axis.java
Method name: `void setTickLabelFont(Font)` |  | Method name: `void setTickMarkStroke(Stroke)`
Number of AST nodes: 5 |  | Number of AST nodes: 5

1

    if (font == null) {↵

1

    if (stroke == null) {↵

2

                throw new IllegalArgumentException("Null 'font' argument.");↵

2

                throw new IllegalArgumentException("Null 'stroke' argument.");↵

3

            }↵

3

            }↵

4

            if (!this.tickLabelFont.equals(font)) {↵

4

            if (!this.tickMarkStroke.equals(stroke)) {↵

5

                this.tickLabelFont = font;↵

5

                this.tickMarkStroke = stroke;↵

6

                notifyListeners(new AxisChangeEvent(this));↵

6

                notifyListeners(new AxisChangeEvent(this));↵

7

            }

7

            }

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3
Clones location | Clones are declared in the same class
Number of node comparisons | 20

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 4
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 1
   Time elapsed for statement mapping (ms) | 1.1
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       if (font == null)

   1 | if (font == null)
   1 | if (stroke == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   font | stroke | VARIABLE_NAME_MISMATCH
   java.awt.Font | java.awt.Stroke | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.awt.Font of variable font does not match with type java.awt.Stroke of variable stroke
   - Make classes java.awt.Font and java.awt.Stroke extend a common superclass

   1

       if (stroke == null)

   2

       throw new IllegalArgumentException("Null 'font' argument.");

   2 | throw new IllegalArgumentException("Null 'font' argument.");
   2 | throw new IllegalArgumentException("Null 'stroke' argument.");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   "Null 'font' argument." | "Null 'stroke' argument." | LITERAL_VALUE_MISMATCH

   2

       throw new IllegalArgumentException("Null 'stroke' argument.");

   3

       if (!this.tickLabelFont.equals(font))

   3 | if (! this.tickLabelFont.equals(font))
   3 | if (! this.tickMarkStroke.equals(stroke))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   font | stroke | VARIABLE_NAME_MISMATCH
   java.awt.Font | java.awt.Stroke | VARIABLE_TYPE_MISMATCH
   tickLabelFont | tickMarkStroke | VARIABLE_NAME_MISMATCH
   java.awt.Font | java.awt.Stroke | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.awt.Font of variable font does not match with type java.awt.Stroke of variable stroke
   - Make classes java.awt.Font and java.awt.Stroke extend a common superclass

   Type java.awt.Font of variable this.tickLabelFont does not match with type java.awt.Stroke of variable this.tickMarkStroke
   - Make classes java.awt.Font and java.awt.Stroke extend a common superclass

   3

       if (!this.tickMarkStroke.equals(stroke))

   4

       this.tickMarkStroke = stroke;

   4

       this.tickLabelFont = font;

   5

       notifyListeners(new AxisChangeEvent(this));

   5

       notifyListeners(new AxisChangeEvent(this));

   Precondition Violations (3)
   Row | Violation
   --- | ---
   1 | Type java.awt.Font of variable font does not match with type java.awt.Stroke of variable stroke
   2 | Type java.awt.Font of variable font does not match with type java.awt.Stroke of variable stroke
   3 | Type java.awt.Font of variable this.tickLabelFont does not match with type java.awt.Stroke of variable this.tickMarkStroke