242-11-12

FastScatterPlot p1 = new FastScatterPlot(); FastScatterPlot p2 = null; try { p2 = (FastScatterPlot) p1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); System.err.println("Failed to clone."); } assertTrue(p1 != p2); assertTrue(p1.getClass() == p2.getClass()); assertTrue(p1.equals(p2));
MultiplePiePlot p1 = new MultiplePiePlot(); MultiplePiePlot p2 = null; try { p2 = (MultiplePiePlot) p1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); System.err.println("Failed to clone."); } assertTrue(p1 != p2); assertTrue(p1.getClass() == p2.getClass()); assertTrue(p1.equals(p2));

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/FastScatterPlotTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/MultiplePiePlotTests.java
Method name: `void testCloning()` |  | Method name: `void testCloning()`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    FastScatterPlot p1 = new FastScatterPlot();↵

1

    MultiplePiePlot p1 = new MultiplePiePlot();↵

2

            FastScatterPlot p2 = null;↵

2

            MultiplePiePlot p2 = null;↵

3

            try {↵

3

            try {↵

4

                p2 = (FastScatterPlot) p1.clone();↵

4

                p2 = (MultiplePiePlot) p1.clone();↵

5

            }↵

5

            }↵

6

            catch (CloneNotSupportedException e) {↵

6

            catch (CloneNotSupportedException e) {↵

7

                e.printStackTrace();↵

7

                e.printStackTrace();↵

8

                System.err.println("Failed to clone.");↵

8

                System.err.println("Failed to clone.");↵

9

            }↵

9

            }↵

10

            assertTrue(p1 != p2);↵

10

            assertTrue(p1 != p2);↵

11

            assertTrue(p1.getClass() == p2.getClass());↵

11

            assertTrue(p1.getClass() == p2.getClass());↵

12

            assertTrue(p1.equals(p2));

12

            assertTrue(p1.equals(p2));

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.2
Clones location | Clones are in different classes having the same super class
Number of node comparisons | 21

1. {Non-refactorable}

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

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

   1

       FastScatterPlot p1 = new FastScatterPlot();

   1 | FastScatterPlot p1 = new FastScatterPlot();
   1 | MultiplePiePlot p1 = new MultiplePiePlot();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.FastScatterPlot | org.jfree.chart.plot.MultiplePiePlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.FastScatterPlot | org.jfree.chart.plot.MultiplePiePlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.FastScatterPlot | org.jfree.chart.plot.MultiplePiePlot | SUBCLASS_TYPE_MISMATCH

   1

       MultiplePiePlot p1 = new MultiplePiePlot();

   2

       FastScatterPlot p2 = null;

   2 | FastScatterPlot p2 = null;
   2 | MultiplePiePlot p2 = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.FastScatterPlot | org.jfree.chart.plot.MultiplePiePlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.FastScatterPlot | org.jfree.chart.plot.MultiplePiePlot | SUBCLASS_TYPE_MISMATCH

   2

       MultiplePiePlot p2 = null;

   3

       try

   3

       try

   4

       p2 = (FastScatterPlot)p1.clone();

   4 | p2 = (FastScatterPlot)p1.clone();
   4 | p2 = (MultiplePiePlot)p1.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.FastScatterPlot | org.jfree.chart.plot.MultiplePiePlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.FastScatterPlot | org.jfree.chart.plot.MultiplePiePlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.FastScatterPlot | org.jfree.chart.plot.MultiplePiePlot | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression (FastScatterPlot)p1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression (MultiplePiePlot)p1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   4

       p2 = (MultiplePiePlot)p1.clone();

   5

       assertTrue(p1 != p2);

   5 | assertTrue(p1 != p2);
   5 | assertTrue(p1 != p2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.plot.FastScatterPlot | org.jfree.chart.plot.MultiplePiePlot | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.plot.FastScatterPlot | org.jfree.chart.plot.MultiplePiePlot | SUBCLASS_TYPE_MISMATCH

   5

       assertTrue(p1 != p2);

   6

       assertTrue(p1.getClass() == p2.getClass());

   6 | assertTrue(p1.getClass() == p2.getClass());
   7 | assertTrue(p1.equals(p2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   p1.getClass() == p2.getClass() | p1.equals(p2) | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression p1.getClass() == p2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression p1.equals(p2) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   7

       assertTrue(p1.equals(p2));

   7

       assertTrue(p1.equals(p2));

   7 | assertTrue(p1.equals(p2));
   6 | assertTrue(p1.getClass() == p2.getClass());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   p1.equals(p2) | p1.getClass() == p2.getClass() | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression p1.equals(p2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression p1.getClass() == p2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   6

       assertTrue(p1.getClass() == p2.getClass());

   Precondition Violations (6)
   Row | Violation
   --- | ---
   1 | Expression (FastScatterPlot)p1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression (MultiplePiePlot)p1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression p1.getClass() == p2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression p1.equals(p2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   5 | Expression p1.equals(p2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression p1.getClass() == p2.getClass() cannot be parameterized, because it has dependencies to/from statements that will be extracted