269-11-12

MinMaxCategoryRenderer r1 = new MinMaxCategoryRenderer(); MinMaxCategoryRenderer r2 = null; try { r2 = (MinMaxCategoryRenderer) r1.clone(); } catch (CloneNotSupportedException e) { System.err.println("Failed to clone."); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2));
StackedBarRenderer r1 = new StackedBarRenderer(); StackedBarRenderer r2 = null; try { r2 = (StackedBarRenderer) 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/category/junit/MinMaxCategoryRendererTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/StackedBarRendererTests.java
Method name: `void testCloning()` |  | Method name: `void testCloning()`
Number of AST nodes: 7 |  | Number of AST nodes: 7

1

    MinMaxCategoryRenderer r1 = new MinMaxCategoryRenderer();↵

1

    StackedBarRenderer r1 = new StackedBarRenderer();↵

2

            MinMaxCategoryRenderer r2 = null;↵

2

            StackedBarRenderer r2 = null;↵

3

            try {↵

3

            try {↵

4

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

4

                r2 = (StackedBarRenderer) 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) | 45.1
   Clone type | Type 2

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

   1

       MinMaxCategoryRenderer r1 = new MinMaxCategoryRenderer();

   1 | MinMaxCategoryRenderer r1 = new MinMaxCategoryRenderer();
   1 | StackedBarRenderer r1 = new StackedBarRenderer();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.MinMaxCategoryRenderer | org.jfree.chart.renderer.category.StackedBarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.MinMaxCategoryRenderer | org.jfree.chart.renderer.category.StackedBarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.MinMaxCategoryRenderer | org.jfree.chart.renderer.category.StackedBarRenderer | SUBCLASS_TYPE_MISMATCH

   1

       StackedBarRenderer r1 = new StackedBarRenderer();

   2

       MinMaxCategoryRenderer r2 = null;

   2 | MinMaxCategoryRenderer r2 = null;
   2 | StackedBarRenderer r2 = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.MinMaxCategoryRenderer | org.jfree.chart.renderer.category.StackedBarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.MinMaxCategoryRenderer | org.jfree.chart.renderer.category.StackedBarRenderer | SUBCLASS_TYPE_MISMATCH

   2

       StackedBarRenderer r2 = null;

   3

       try

   3

       try

   4

       r2 = (MinMaxCategoryRenderer)r1.clone();

   4 | r2 = (MinMaxCategoryRenderer)r1.clone();
   4 | r2 = (StackedBarRenderer)r1.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.MinMaxCategoryRenderer | org.jfree.chart.renderer.category.StackedBarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.MinMaxCategoryRenderer | org.jfree.chart.renderer.category.StackedBarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.MinMaxCategoryRenderer | org.jfree.chart.renderer.category.StackedBarRenderer | SUBCLASS_TYPE_MISMATCH

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

   4

       r2 = (StackedBarRenderer)r1.clone();

   5

       assertTrue(r1 != r2);

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.MinMaxCategoryRenderer | org.jfree.chart.renderer.category.StackedBarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.MinMaxCategoryRenderer | org.jfree.chart.renderer.category.StackedBarRenderer | 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 (MinMaxCategoryRenderer)r1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression (StackedBarRenderer)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