CompassPlot p1 = new CompassPlot(null); p1.setRosePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); p1.setRoseCenterPaint(new GradientPaint(4.0f, 3.0f, Color.red, 2.0f, 1.0f, Color.green)); p1.setRoseHighlightPaint(new GradientPaint(4.0f, 3.0f, Color.red, 2.0f, 1.0f, Color.green)); CompassPlot p2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(p1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); p2 = (CompassPlot) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(p1, p2);
PolarPlot p1 = new PolarPlot(); p1.setAngleGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); p1.setAngleLabelPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); p1.setRadiusGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue)); PolarPlot p2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(p1); out.close(); ObjectInput in = new ObjectInputStream( new ByteArrayInputStream(buffer.toByteArray())); p2 = (PolarPlot) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(p1, p2);
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/CompassPlotTests.java File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/PolarPlotTests.java
Method name: void testSerialization() Method name: void testSerialization()
Number of AST nodes: 14 Number of AST nodes: 14
1
CompassPlot p1 = new CompassPlot(null);
1
PolarPlot p1 = new PolarPlot();
2
        p1.setRosePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, 
2
        p1.setAngleGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
3
                Color.blue));
3
                4.0f, Color.blue));
4
        p1.setRoseCenterPaint(new GradientPaint(4.0f, 3.0f, Color.red, 2.0f,
4
        p1.setAngleLabelPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
5
                1.0f, Color.green));
5
                4.0f, Color.blue));
6
        p1.setRoseHighlightPaint(new GradientPaint(4.0f, 3.0f, Color.red, 2.0f,
6
        p1.setRadiusGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f,
7
                1.0f, Color.green));
7
                4.0f, Color.blue));
8
        CompassPlot p2 = null;
8
        PolarPlot p2 = null;
9
        try {
9
        try {
10
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
10
            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
11
            ObjectOutput out = new ObjectOutputStream(buffer);
11
            ObjectOutput out = new ObjectOutputStream(buffer);
12
            out.writeObject(p1);
12
            out.writeObject(p1);
13
            out.close();
13
            out.close();
14
            ObjectInput in = new ObjectInputStream(
14
            ObjectInput in = new ObjectInputStream(
15
                    new ByteArrayInputStream(buffer.toByteArray()));
15
                    new ByteArrayInputStream(buffer.toByteArray()));
16
            p2 = (CompassPlot) in.readObject();
16
            p2 = (PolarPlot) in.readObject();
17
            in.close();
17
            in.close();
18
        }
18
        }
19
        catch (Exception e) {
19
        catch (Exception e) {
20
            e.printStackTrace();
20
            e.printStackTrace();
21
        }
21
        }
22
        assertEquals(p1, p2);
22
        assertEquals(p1, p2);
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 in different classes having the same super class
Number of node comparisons84
  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 fragment0
    Time elapsed for statement mapping (ms)68.3
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    CompassPlot p1 = new CompassPlot(null);
    1
    CompassPlot p1 = new CompassPlot(null);
    1
    PolarPlot p1 = new PolarPlot();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    new CompassPlot(null)new PolarPlot()ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression new CompassPlot(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new PolarPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new CompassPlot(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression new PolarPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    1
    PolarPlot p1 = new PolarPlot();
    2
    p1.setRosePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    2
    p1.setRosePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    3
    p1.setAngleLabelPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    Differences
    Expression1Expression2Difference
    setRosePaintsetAngleLabelPaintMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression p1.setRosePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p1.setAngleLabelPaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p1.setRosePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) is a void method call, and thus it cannot be parameterized
    Expression p1.setAngleLabelPaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) is a void method call, and thus it cannot be parameterized
    Expression p1 cannot be unified with expression p1 , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void setRosePaint(java.awt.Paint) , public void setAngleLabelPaint(java.awt.Paint)
    3
    p1.setAngleLabelPaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    3
    p1.setRoseCenterPaint(new GradientPaint(4.0f, 3.0f, Color.red, 2.0f, 1.0f, Color.green));
    3
    p1.setRoseCenterPaint(new GradientPaint(4.0f, 3.0f, Color.red, 2.0f, 1.0f, Color.green));
    2
    p1.setAngleGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    Differences
    Expression1Expression2Difference
    4.0f1.0fLITERAL_VALUE_MISMATCH
    3.0f2.0fLITERAL_VALUE_MISMATCH
    2.0f3.0fLITERAL_VALUE_MISMATCH
    1.0f4.0fLITERAL_VALUE_MISMATCH
    greenblueVARIABLE_NAME_MISMATCH
    setRoseCenterPaintsetAngleGridlinePaintMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression p1.setRoseCenterPaint(new GradientPaint(4.0f,3.0f,Color.red,2.0f,1.0f,Color.green)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p1.setAngleGridlinePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p1.setRoseCenterPaint(new GradientPaint(4.0f,3.0f,Color.red,2.0f,1.0f,Color.green)) is a void method call, and thus it cannot be parameterized
    Expression p1.setAngleGridlinePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) is a void method call, and thus it cannot be parameterized
    Expression p1 cannot be unified with expression p1 , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void setRoseCenterPaint(java.awt.Paint) , public void setAngleGridlinePaint(java.awt.Paint)
    2
    p1.setAngleGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    4
    p1.setRoseHighlightPaint(new GradientPaint(4.0f, 3.0f, Color.red, 2.0f, 1.0f, Color.green));
    4
    p1.setRoseHighlightPaint(new GradientPaint(4.0f, 3.0f, Color.red, 2.0f, 1.0f, Color.green));
    4
    p1.setRadiusGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    Differences
    Expression1Expression2Difference
    4.0f1.0fLITERAL_VALUE_MISMATCH
    3.0f2.0fLITERAL_VALUE_MISMATCH
    2.0f3.0fLITERAL_VALUE_MISMATCH
    1.0f4.0fLITERAL_VALUE_MISMATCH
    greenblueVARIABLE_NAME_MISMATCH
    setRoseHighlightPaintsetRadiusGridlinePaintMETHOD_INVOCATION_NAME_MISMATCH
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression p1.setRoseHighlightPaint(new GradientPaint(4.0f,3.0f,Color.red,2.0f,1.0f,Color.green)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p1.setRadiusGridlinePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p1.setRoseHighlightPaint(new GradientPaint(4.0f,3.0f,Color.red,2.0f,1.0f,Color.green)) is a void method call, and thus it cannot be parameterized
    Expression p1.setRadiusGridlinePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) is a void method call, and thus it cannot be parameterized
    Expression p1 cannot be unified with expression p1 , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void setRoseHighlightPaint(java.awt.Paint) , public void setRadiusGridlinePaint(java.awt.Paint)
    4
    p1.setRadiusGridlinePaint(new GradientPaint(1.0f, 2.0f, Color.red, 3.0f, 4.0f, Color.blue));
    5
    CompassPlot p2 = null;
    5
    CompassPlot p2 = null;
    5
    PolarPlot p2 = null;
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    5
    PolarPlot p2 = null;
    6
    try
    6
    try
    7
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    7
    ByteArrayOutputStream buffer = new ByteArrayOutputStream();
    8
    ObjectOutput out = new ObjectOutputStream(buffer);
    8
    ObjectOutput out = new ObjectOutputStream(buffer);
    9
    out.writeObject(p1);
    9
    out.writeObject(p1);
    9
    out.writeObject(p1);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    9
    out.writeObject(p1);
    10
    out.close();
    10
    out.close();
    11
    ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
    11
    ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray()));
    12
    p2 = (CompassPlot)in.readObject();
    12
    p2 = (CompassPlot)in.readObject();
    12
    p2 = (PolarPlot)in.readObject();
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Expression (CompassPlot)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression (PolarPlot)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12
    p2 = (PolarPlot)in.readObject();
    13
    in.close();
    13
    in.close();
    14
    assertEquals(p1, p2);
    14
    assertEquals(p1, p2);
    14
    assertEquals(p1, p2);
    Differences
    Expression1Expression2Difference
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    org.jfree.chart.plot.CompassPlotorg.jfree.chart.plot.PolarPlotSUBCLASS_TYPE_MISMATCH
    14
    assertEquals(p1, p2);
    Precondition Violations (21)
    Row Violation
    1Expression new CompassPlot(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression new PolarPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression new CompassPlot(null) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression new PolarPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression p1.setRosePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression p1.setAngleLabelPaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression p1.setRosePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) is a void method call, and thus it cannot be parameterized
    8Expression p1.setAngleLabelPaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) is a void method call, and thus it cannot be parameterized
    9Expression p1 cannot be unified with expression p1 , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void setRosePaint(java.awt.Paint) , public void setAngleLabelPaint(java.awt.Paint)
    10Expression p1.setRoseCenterPaint(new GradientPaint(4.0f,3.0f,Color.red,2.0f,1.0f,Color.green)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression p1.setAngleGridlinePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression p1.setRoseCenterPaint(new GradientPaint(4.0f,3.0f,Color.red,2.0f,1.0f,Color.green)) is a void method call, and thus it cannot be parameterized
    13Expression p1.setAngleGridlinePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) is a void method call, and thus it cannot be parameterized
    14Expression p1 cannot be unified with expression p1 , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void setRoseCenterPaint(java.awt.Paint) , public void setAngleGridlinePaint(java.awt.Paint)
    15Expression p1.setRoseHighlightPaint(new GradientPaint(4.0f,3.0f,Color.red,2.0f,1.0f,Color.green)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    16Expression p1.setRadiusGridlinePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    17Expression p1.setRoseHighlightPaint(new GradientPaint(4.0f,3.0f,Color.red,2.0f,1.0f,Color.green)) is a void method call, and thus it cannot be parameterized
    18Expression p1.setRadiusGridlinePaint(new GradientPaint(1.0f,2.0f,Color.red,3.0f,4.0f,Color.blue)) is a void method call, and thus it cannot be parameterized
    19Expression p1 cannot be unified with expression p1 , because common superclass org.jfree.chart.plot.Plot does not declare member(s) public void setRoseHighlightPaint(java.awt.Paint) , public void setRadiusGridlinePaint(java.awt.Paint)
    20Expression (CompassPlot)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    21Expression (PolarPlot)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted