269-2-9

WindItemRenderer r1 = new WindItemRenderer(); WindItemRenderer r2 = null; try { r2 = (WindItemRenderer) r1.clone(); } catch (CloneNotSupportedException e) { System.err.println("Failed to clone."); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2));
XYStepRenderer r1 = new XYStepRenderer(); XYStepRenderer r2 = null; try { r2 = (XYStepRenderer) r1.clone(); } catch (CloneNotSupportedException e) { System.err.println("Failed to clone."); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2));

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

1

    WindItemRenderer r1 = new WindItemRenderer();↵

1

    XYStepRenderer r1 = new XYStepRenderer();↵

2

            WindItemRenderer r2 = null;↵

2

            XYStepRenderer r2 = null;↵

3

            try {↵

3

            try {↵

4

                r2 = (WindItemRenderer) r1.clone();↵

4

                r2 = (XYStepRenderer) r1.clone();↵

5

            }↵

5

            }↵

6

            catch (CloneNotSupportedException e) {↵

6

            catch (CloneNotSupportedException e) {↵

7

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

7

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

8

            }↵

8

            }↵

9

            assertTrue(r1 != r2);↵

9

            assertTrue(r1 != r2);↵

10

            assertTrue(r1.getClass() == r2.getClass());↵

10

            assertTrue(r1.getClass() == r2.getClass());↵

11

            assertTrue(r1.equals(r2));

11

            assertTrue(r1.equals(r2));

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) | 76.9
   Clone type | Type 2

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

   1

       WindItemRenderer r1 = new WindItemRenderer();

   1 | WindItemRenderer r1 = new WindItemRenderer();
   1 | XYStepRenderer r1 = new XYStepRenderer();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.xy.WindItemRenderer | org.jfree.chart.renderer.xy.XYStepRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.xy.WindItemRenderer | org.jfree.chart.renderer.xy.XYStepRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.xy.WindItemRenderer | org.jfree.chart.renderer.xy.XYStepRenderer | SUBCLASS_TYPE_MISMATCH

   1

       XYStepRenderer r1 = new XYStepRenderer();

   2

       WindItemRenderer r2 = null;

   2 | WindItemRenderer r2 = null;
   2 | XYStepRenderer r2 = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.xy.WindItemRenderer | org.jfree.chart.renderer.xy.XYStepRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.xy.WindItemRenderer | org.jfree.chart.renderer.xy.XYStepRenderer | SUBCLASS_TYPE_MISMATCH

   2

       XYStepRenderer r2 = null;

   3

       try

   3

       try

   4

       r2 = (WindItemRenderer)r1.clone();

   4 | r2 = (WindItemRenderer)r1.clone();
   4 | r2 = (XYStepRenderer)r1.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.xy.WindItemRenderer | org.jfree.chart.renderer.xy.XYStepRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.xy.WindItemRenderer | org.jfree.chart.renderer.xy.XYStepRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.xy.WindItemRenderer | org.jfree.chart.renderer.xy.XYStepRenderer | SUBCLASS_TYPE_MISMATCH

   Preondition Violations
   Expression (WindItemRenderer)r1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression (XYStepRenderer)r1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted

   4

       r2 = (XYStepRenderer)r1.clone();

   5

       assertTrue(r1 != r2);

   5 | assertTrue(r1 != r2);
   5 | assertTrue(r1 != r2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.xy.WindItemRenderer | org.jfree.chart.renderer.xy.XYStepRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.xy.WindItemRenderer | org.jfree.chart.renderer.xy.XYStepRenderer | SUBCLASS_TYPE_MISMATCH

   5

       assertTrue(r1 != r2);

   6

       assertTrue(r1.getClass() == r2.getClass());

   6 | assertTrue(r1.getClass() == r2.getClass());
   7 | assertTrue(r1.equals(r2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   r1.getClass() == r2.getClass() | r1.equals(r2) | TYPE_COMPATIBLE_REPLACEMENT

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

   7

       assertTrue(r1.equals(r2));

   7

       assertTrue(r1.equals(r2));

   7 | assertTrue(r1.equals(r2));
   6 | assertTrue(r1.getClass() == r2.getClass());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   r1.equals(r2) | r1.getClass() == r2.getClass() | TYPE_COMPATIBLE_REPLACEMENT

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

   6

       assertTrue(r1.getClass() == r2.getClass());

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