if (autoPopulate) { DrawingSupplier ds = getDrawingSupplier(); if (ds != null) { result = ds.getNextPaint(); this.sectionPaintMap.put(key, result); } else { result = this.baseSectionPaint; } } else { result = this.baseSectionPaint; }
if (autoPopulate) { DrawingSupplier ds = getDrawingSupplier(); if (ds != null) { result = ds.getNextOutlineStroke(); this.sectionOutlineStrokeMap.put(key, result); } else { result = this.baseSectionOutlineStroke; } } else { result = this.baseSectionOutlineStroke; }
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PiePlot.java File path: /jfreechart-1.0.10/src/org/jfree/chart/plot/PiePlot.java
Method name: Paint lookupSectionPaint(Comparable, boolean) Method name: Stroke lookupSectionOutlineStroke(Comparable, boolean)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (autoPopulate) {
1
if (autoPopulate) {
2
            DrawingSupplier ds = getDrawingSupplier();
2
            DrawingSupplier ds = getDrawingSupplier();
3
            if (ds != null) {
3
            if (ds != null) {
4
                result = ds.getNextPaint();
4
                result = ds.getNextOutlineStroke();
5
                this.sectionPaintMap.put(key, result);
5
                this.sectionOutlineStrokeMap.put(key, result);
6
            }
6
            }
7
            else {
7
            else {
8
                result = this.baseSectionPaint;
8
                result = this.baseSectionOutlineStroke;
9
            }
9
            }
10
        }
10
        }
11
        else {
11
        else {
12
            result = this.baseSectionPaint;
12
            result = this.baseSectionOutlineStroke;
13
        }
13
        }
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 declared in the same class
Number of node comparisons25
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)18.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    if (autoPopulate)
    7
    if (autoPopulate)
    8
    DrawingSupplier ds = getDrawingSupplier();
    8
    DrawingSupplier ds = getDrawingSupplier();
    9
    if (ds != null)
    9
    if (ds != null)
                                                                              
    10
    result = ds.getNextOutlineStroke();
    Preondition Violations
    Unmatched statement result=ds.getNextOutlineStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    result = ds.getNextOutlineStroke();
    10
    result = ds.getNextPaint();
    10
    result = ds.getNextPaint();
    Preondition Violations
    Unmatched statement result=ds.getNextPaint(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                              
    11
    this.sectionPaintMap.put(key, result);
    11
    this.sectionPaintMap.put(key, result);
    11
    this.sectionOutlineStrokeMap.put(key, result);
    Differences
    Expression1Expression2Difference
    java.awt.Paintjava.awt.StrokeVARIABLE_TYPE_MISMATCH
    sectionPaintMapsectionOutlineStrokeMapVARIABLE_NAME_MISMATCH
    org.jfree.chart.PaintMaporg.jfree.chart.StrokeMapVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.awt.Paint of variable result does not match with type java.awt.Stroke of variable result
    • Make classes java.awt.Paint and java.awt.Stroke extend a common superclass
    Type org.jfree.chart.PaintMap of variable this.sectionPaintMap does not match with type org.jfree.chart.StrokeMap of variable this.sectionOutlineStrokeMap
    • Make classes org.jfree.chart.PaintMap and org.jfree.chart.StrokeMap extend a common superclass
    11
    this.sectionOutlineStrokeMap.put(key, result);
    else
            
                                                                                      
    12
    result = this.baseSectionOutlineStroke;
    Preondition Violations
    Unmatched statement result=this.baseSectionOutlineStroke; cannot be moved, because it updates a variable modified in other unmapped statements
    12
    result = this.baseSectionOutlineStroke;
    12
    result = this.baseSectionPaint;
    12
    result = this.baseSectionPaint;
    Preondition Violations
    Unmatched statement result=this.baseSectionPaint; cannot be moved, because it updates a variable modified in other unmapped statements
                                                                      
    else
            
                                                                                      
    13
    result = this.baseSectionOutlineStroke;
    Preondition Violations
    Unmatched statement result=this.baseSectionOutlineStroke; cannot be moved, because it updates a variable modified in other unmapped statements
    13
    result = this.baseSectionOutlineStroke;
    13
    result = this.baseSectionPaint;
    13
    result = this.baseSectionPaint;
    Preondition Violations
    Unmatched statement result=this.baseSectionPaint; cannot be moved, because it updates a variable modified in other unmapped statements
                                                                      
    Precondition Violations (8)
    Row Violation
    1Unmatched statement result=ds.getNextOutlineStroke(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement result=ds.getNextPaint(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type java.awt.Paint of variable result does not match with type java.awt.Stroke of variable result
    4Type org.jfree.chart.PaintMap of variable this.sectionPaintMap does not match with type org.jfree.chart.StrokeMap of variable this.sectionOutlineStrokeMap
    5Unmatched statement result=this.baseSectionPaint; cannot be moved, because it updates a variable modified in other unmapped statements
    6Unmatched statement result=this.baseSectionPaint; cannot be moved, because it updates a variable modified in other unmapped statements
    7Unmatched statement result=this.baseSectionOutlineStroke; cannot be moved, because it updates a variable modified in other unmapped statements
    8Unmatched statement result=this.baseSectionOutlineStroke; cannot be moved, because it updates a variable modified in other unmapped statements