DefaultPieDataset dataset = new DefaultPieDataset(); dataset.setValue("L1", 12.0); dataset.setValue("L2", 11.0); JFreeChart chart = ChartFactory.createPieChart("Test", dataset, true, false, false); PiePlot plot = (PiePlot) chart.getPlot(); plot.setLegendLabelGenerator(new NullLegendLabelGenerator()); boolean success = false; try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null); g2.dispose(); success = true; } catch (Exception e) { success = false; } assertTrue(success);
DefaultCategoryDataset dataset = new DefaultCategoryDataset(); dataset.addValue(35.0, "S1", "C1"); dataset.addValue(45.0, "S1", "C2"); dataset.addValue(55.0, "S1", "C3"); dataset.addValue(15.0, "S1", "C4"); dataset.addValue(25.0, "S1", "C5"); SpiderWebPlot plot = new SpiderWebPlot(dataset); JFreeChart chart = new JFreeChart(plot); boolean success = false; try { BufferedImage image = new BufferedImage(200 , 100, BufferedImage.TYPE_INT_RGB); Graphics2D g2 = image.createGraphics(); chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null); g2.dispose(); success = true; } catch (Exception e) { success = false; } assertTrue(success);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/PiePlotTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/SpiderWebPlotTests.java
Method name: void testDrawWithNullLegendLabels() Method name: void testDrawWithNullInfo()
Number of AST nodes: 14 Number of AST nodes: 16
1
DefaultPieDataset dataset = new DefaultPieDataset();
1
DefaultCategoryDataset dataset = new DefaultCategoryDataset();
2
        dataset.setValue("L1", 12.0);
2
        dataset.addValue(35.0, "S1", "C1");
3
        dataset.setValue("L2", 11.0);
3
        dataset.addValue(
4
        JFreeChart chart = ChartFactory.createPieChart("Test", dataset, true, 
5
                false, false
4
45.0, "S1", "C2");
5
        dataset.addValue(55.0, "S1", "C3");
6
        dataset.addValue(15.0, "S1", "C4");
6
);
7
        dataset.addValue(25.0, "S1", "C5");
7
        PiePlot plot = (PiePlot) chart.getPlot();
8
        SpiderWebPlot plot = 
8
        plot.setLegendLabelGenerator(new NullLegendLabelGenerator()
9
new SpiderWebPlot(dataset);
9
);
10
        JFreeChart chart = new JFreeChart(plot);
10
        boolean success = false;
11
        boolean success = false;
11
        try {
12
        try {
12
            BufferedImage image = new BufferedImage(200 , 100, 
13
            BufferedImage image = new BufferedImage(200 , 100,
13
                    BufferedImage.TYPE_INT_RGB);
14
                    BufferedImage.TYPE_INT_RGB);
14
            Graphics2D g2 = image.createGraphics();
15
            Graphics2D g2 = image.createGraphics();
15
            chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
16
            chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
16
            g2.dispose();
17
            g2.dispose();
17
            success = true;
18
            success = true;
18
        }
19
        }
19
        catch (Exception e) {
20
        catch (Exception e) {
20
          success = false;
21
            success = false;
21
        }
22
        }
22
        assertTrue(success);
23
        assertTrue(success);
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.1
Clones locationClones are in different classes having the same super class
Number of node comparisons83
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)217.1
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    DefaultPieDataset dataset = new DefaultPieDataset();
    1
    DefaultPieDataset dataset = new DefaultPieDataset();
    1
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    Differences
    Expression1Expression2Difference
    org.jfree.data.general.DefaultPieDatasetorg.jfree.data.category.DefaultCategoryDatasetSUBCLASS_TYPE_MISMATCH
    org.jfree.data.general.DefaultPieDatasetorg.jfree.data.category.DefaultCategoryDatasetSUBCLASS_TYPE_MISMATCH
    org.jfree.data.general.DefaultPieDatasetorg.jfree.data.category.DefaultCategoryDatasetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression new DefaultPieDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new DefaultCategoryDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();
    2
    dataset.setValue("L1", 12.0);
    2
    dataset.setValue("L1", 12.0);
    2
    dataset.addValue(35.0, "S1", "C1");
    Differences
    Expression1Expression2Difference
    setValueaddValueMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.data.general.DefaultPieDatasetorg.jfree.data.category.DefaultCategoryDatasetSUBCLASS_TYPE_MISMATCH
    dataset.setValue("L1",12.0)dataset.addValue(35.0,"S1","C1")ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression dataset.setValue("L1",12.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset.addValue(35.0,"S1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset.setValue("L1",12.0) is a void method call, and thus it cannot be parameterized
    Expression dataset.addValue(35.0,"S1","C1") is a void method call, and thus it cannot be parameterized
    Expression dataset cannot be unified with expression dataset , because common superclass org.jfree.data.general.AbstractDataset does not declare member(s) public void setValue(Comparable#RAW, double) , public void addValue(double, Comparable#RAW, Comparable#RAW)
    Expression dataset.setValue("L1",12.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset.addValue(35.0,"S1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset.setValue("L1",12.0) is a void method call, and thus it cannot be parameterized
    Expression dataset.addValue(35.0,"S1","C1") is a void method call, and thus it cannot be parameterized
    2
    dataset.addValue(35.0, "S1", "C1");
    3
    dataset.setValue("L2", 11.0);
    3
    dataset.setValue("L2", 11.0);
    3
    dataset.addValue(45.0, "S1", "C2");
    Differences
    Expression1Expression2Difference
    setValueaddValueMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.data.general.DefaultPieDatasetorg.jfree.data.category.DefaultCategoryDatasetSUBCLASS_TYPE_MISMATCH
    dataset.setValue("L2",11.0)dataset.addValue(45.0,"S1","C2")ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression dataset.setValue("L2",11.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset.addValue(45.0,"S1","C2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset.setValue("L2",11.0) is a void method call, and thus it cannot be parameterized
    Expression dataset.addValue(45.0,"S1","C2") is a void method call, and thus it cannot be parameterized
    Expression dataset cannot be unified with expression dataset , because common superclass org.jfree.data.general.AbstractDataset does not declare member(s) public void setValue(Comparable#RAW, double) , public void addValue(double, Comparable#RAW, Comparable#RAW)
    Expression dataset.setValue("L2",11.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset.addValue(45.0,"S1","C2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset.setValue("L2",11.0) is a void method call, and thus it cannot be parameterized
    Expression dataset.addValue(45.0,"S1","C2") is a void method call, and thus it cannot be parameterized
    3
    dataset.addValue(45.0, "S1", "C2");
                                                                            
    4
    dataset.addValue(55.0, "S1", "C3");
    Preondition Violations
    Unmatched statement dataset.addValue(55.0,"S1","C3"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4
    dataset.addValue(55.0, "S1", "C3");
                                                                            
    5
    dataset.addValue(15.0, "S1", "C4");
    Preondition Violations
    Unmatched statement dataset.addValue(15.0,"S1","C4"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5
    dataset.addValue(15.0, "S1", "C4");
    4
    JFreeChart chart = ChartFactory.createPieChart("Test", dataset, true, false, false);
    4
    JFreeChart chart = ChartFactory.createPieChart("Test", dataset, true, false, false);
    8
    JFreeChart chart = new JFreeChart(plot);
    Differences
    Expression1Expression2Difference
    ChartFactory.createPieChart("Test",dataset,true,false,false)new JFreeChart(plot)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression ChartFactory.createPieChart("Test",dataset,true,false,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new JFreeChart(plot) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    JFreeChart chart = new JFreeChart(plot);
    5
    PiePlot plot = (PiePlot)chart.getPlot();
    5
    PiePlot plot = (PiePlot)chart.getPlot();
    7
    SpiderWebPlot plot = new SpiderWebPlot(dataset);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.PiePlotorg.jfree.chart.plot.SpiderWebPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.PiePlotorg.jfree.chart.plot.SpiderWebPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.PiePlotorg.jfree.chart.plot.SpiderWebPlotSUBCLASS_TYPE_MISMATCH
    (PiePlot)chart.getPlot()new SpiderWebPlot(dataset)TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression (PiePlot)chart.getPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new SpiderWebPlot(dataset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    SpiderWebPlot plot = new SpiderWebPlot(dataset);
    6
    plot.setLegendLabelGenerator(new NullLegendLabelGenerator());
    6
    plot.setLegendLabelGenerator(new NullLegendLabelGenerator());
    6
    dataset.addValue(25.0, "S1", "C5");
    Differences
    Expression1Expression2Difference
    setLegendLabelGeneratoraddValueMETHOD_INVOCATION_NAME_MISMATCH
    plotdatasetVARIABLE_NAME_MISMATCH
    org.jfree.chart.plot.PiePlotorg.jfree.data.category.DefaultCategoryDatasetSUBCLASS_TYPE_MISMATCH
    plot.setLegendLabelGenerator(new NullLegendLabelGenerator())dataset.addValue(25.0,"S1","C5")ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression plot.setLegendLabelGenerator(new NullLegendLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset.addValue(25.0,"S1","C5") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.setLegendLabelGenerator(new NullLegendLabelGenerator()) is a void method call, and thus it cannot be parameterized
    Expression dataset.addValue(25.0,"S1","C5") is a void method call, and thus it cannot be parameterized
    Expression plot cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot cannot be unified with expression dataset , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setLegendLabelGenerator(org.jfree.chart.labels.PieSectionLabelGenerator) , public void addValue(double, Comparable#RAW, Comparable#RAW)
    Expression plot.setLegendLabelGenerator(new NullLegendLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression dataset.addValue(25.0,"S1","C5") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression plot.setLegendLabelGenerator(new NullLegendLabelGenerator()) is a void method call, and thus it cannot be parameterized
    Expression dataset.addValue(25.0,"S1","C5") is a void method call, and thus it cannot be parameterized
    6
    dataset.addValue(25.0, "S1", "C5");
    7
    boolean success = false;
    9
    boolean success = false;
    8
    try
    10
    try
    9
    BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
    11
    BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
    10
    Graphics2D g2 = image.createGraphics();
    12
    Graphics2D g2 = image.createGraphics();
    11
    chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
    13
    chart.draw(g2, new Rectangle2D.Double(0, 0, 200, 100), null, null);
    12
    g2.dispose();
    14
    g2.dispose();
    13
    success = true;
    15
    success = true;
    14
    assertTrue(success);
    16
    assertTrue(success);
    Precondition Violations (37)
    Row Violation
    1Expression new DefaultPieDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new DefaultCategoryDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression dataset.setValue("L1",12.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression dataset.addValue(35.0,"S1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression dataset.setValue("L1",12.0) is a void method call, and thus it cannot be parameterized
    6Expression dataset.addValue(35.0,"S1","C1") is a void method call, and thus it cannot be parameterized
    7Expression dataset cannot be unified with expression dataset , because common superclass org.jfree.data.general.AbstractDataset does not declare member(s) public void setValue(Comparable#RAW, double) , public void addValue(double, Comparable#RAW, Comparable#RAW)
    8Expression dataset.setValue("L1",12.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression dataset.addValue(35.0,"S1","C1") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression dataset.setValue("L1",12.0) is a void method call, and thus it cannot be parameterized
    11Expression dataset.addValue(35.0,"S1","C1") is a void method call, and thus it cannot be parameterized
    12Expression dataset.setValue("L2",11.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    13Expression dataset.addValue(45.0,"S1","C2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    14Expression dataset.setValue("L2",11.0) is a void method call, and thus it cannot be parameterized
    15Expression dataset.addValue(45.0,"S1","C2") is a void method call, and thus it cannot be parameterized
    16Expression dataset cannot be unified with expression dataset , because common superclass org.jfree.data.general.AbstractDataset does not declare member(s) public void setValue(Comparable#RAW, double) , public void addValue(double, Comparable#RAW, Comparable#RAW)
    17Expression dataset.setValue("L2",11.0) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    18Expression dataset.addValue(45.0,"S1","C2") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    19Expression dataset.setValue("L2",11.0) is a void method call, and thus it cannot be parameterized
    20Expression dataset.addValue(45.0,"S1","C2") is a void method call, and thus it cannot be parameterized
    21Unmatched statement dataset.addValue(55.0,"S1","C3"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    22Unmatched statement dataset.addValue(15.0,"S1","C4"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    23Expression ChartFactory.createPieChart("Test",dataset,true,false,false) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    24Expression new JFreeChart(plot) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    25Expression (PiePlot)chart.getPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    26Expression new SpiderWebPlot(dataset) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    27Expression plot.setLegendLabelGenerator(new NullLegendLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    28Expression dataset.addValue(25.0,"S1","C5") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    29Expression plot.setLegendLabelGenerator(new NullLegendLabelGenerator()) is a void method call, and thus it cannot be parameterized
    30Expression dataset.addValue(25.0,"S1","C5") is a void method call, and thus it cannot be parameterized
    31Expression plot cannot be parameterized, because it has dependencies to/from statements that will be extracted
    32Expression dataset cannot be parameterized, because it has dependencies to/from statements that will be extracted
    33Expression plot cannot be unified with expression dataset , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setLegendLabelGenerator(org.jfree.chart.labels.PieSectionLabelGenerator) , public void addValue(double, Comparable#RAW, Comparable#RAW)
    34Expression plot.setLegendLabelGenerator(new NullLegendLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    35Expression dataset.addValue(25.0,"S1","C5") cannot be parameterized, because it has dependencies to/from statements that will be extracted
    36Expression plot.setLegendLabelGenerator(new NullLegendLabelGenerator()) is a void method call, and thus it cannot be parameterized
    37Expression dataset.addValue(25.0,"S1","C5") is a void method call, and thus it cannot be parameterized