1256-1-2

Font result = this.itemLabelFont; if (result == null) { result = getSeriesItemLabelFont(row); if (result == null) { result = this.baseItemLabelFont; } } return result;
Paint result = this.itemLabelPaint; if (result == null) { result = getSeriesItemLabelPaint(row); if (result == null) { result = this.baseItemLabelPaint; } } return result;

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/AbstractRenderer.java |  | File path: /jfreechart-1.0.10/src/org/jfree/chart/renderer/AbstractRenderer.java
Method name: `Font getItemLabelFont(int, int)` |  | Method name: `Paint getItemLabelPaint(int, int)`
Number of AST nodes: 6 |  | Number of AST nodes: 6

1

    Font result = this.itemLabelFont;↵

1

    Paint result = this.itemLabelPaint;↵

2

            if (result == null) {↵

2

            if (result == null) {↵

3

                result = getSeriesItemLabelFont(row);↵

3

                result = getSeriesItemLabelPaint(row);↵

4

                if (result == null) {↵

4

                if (result == null) {↵

5

                    result = this.baseItemLabelFont;↵

5

                    result = this.baseItemLabelPaint;↵

6

                }↵

6

                }↵

7

            }↵

7

            }↵

8

            return result;

8

            return result;

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.1
Clones location | Clones are declared in the same class
Number of node comparisons | 12

1. {Non-refactorable}

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

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

   1

       Paint result = this.itemLabelPaint;

   1

       Font result = this.itemLabelFont;

   2

       if (result == null)

   2 | if (result == null)
   2 | if (result == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   java.awt.Font | java.awt.Paint | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   2

       if (result == null)

   3 | result = getSeriesItemLabelPaint(row);

   Preondition Violations
   Unmatched statement result=getSeriesItemLabelPaint(row); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   3

       result = getSeriesItemLabelPaint(row);

   3

       result = getSeriesItemLabelFont(row);

   3 | result = getSeriesItemLabelFont(row);

   Preondition Violations
   Unmatched statement result=getSeriesItemLabelFont(row); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   4

       if (result == null)

   4 | if (result == null)
   4 | if (result == null)

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   java.awt.Font | java.awt.Paint | VARIABLE_TYPE_MISMATCH

   Preondition Violations

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

   4

       if (result == null)

   5 | result = this.baseItemLabelPaint;

   Preondition Violations
   Unmatched statement result=this.baseItemLabelPaint; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   5

       result = this.baseItemLabelPaint;

   5

       result = this.baseItemLabelFont;

   5 | result = this.baseItemLabelFont;

   Preondition Violations
   Unmatched statement result=this.baseItemLabelFont; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   6 | return result;

   Preondition Violations
   Unmatched return result;

   6

       return result;

   6

       return result;

   6 | return result;

   Preondition Violations
   Unmatched return result;

   Precondition Violations (8)
   Row | Violation
   --- | ---
   1 | Type java.awt.Font of variable result does not match with type java.awt.Paint of variable result
   2 | Unmatched statement result=getSeriesItemLabelPaint(row); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   3 | Unmatched statement result=getSeriesItemLabelFont(row); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   4 | Type java.awt.Font of variable result does not match with type java.awt.Paint of variable result
   5 | Unmatched statement result=this.baseItemLabelPaint; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   6 | Unmatched statement result=this.baseItemLabelFont; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   7 | Unmatched return result;
   8 | Unmatched return result;