181-2-3

DefaultPolarItemRenderer r1 = new DefaultPolarItemRenderer(); DefaultPolarItemRenderer r2 = null; try { r2 = (DefaultPolarItemRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); r1.setSeriesFilled(1, true); assertFalse(r1.equals(r2)); r2.setSeriesFilled(1, true); assertTrue(r1.equals(r2));
ExtendedCategoryAxis a1 = new ExtendedCategoryAxis("Test"); ExtendedCategoryAxis a2 = null; try { a2 = (ExtendedCategoryAxis) a1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(a1 != a2); assertTrue(a1.getClass() == a2.getClass()); assertTrue(a1.equals(a2)); // check independence a1.addSubLabel("C1", "ABC"); assertFalse(a1.equals(a2)); a2.addSubLabel("C1", "ABC"); assertTrue(a1.equals(a2));

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

1

    DefaultPolarItemRenderer r1 = new DefaultPolarItemRenderer();↵

2

            DefaultPolarItemRenderer r↵

1

    ExtendedCategoryAxis a1 = new ExtendedCategoryAxis("Test");↵

3

    2 = null;↵

2

            ExtendedCategoryAxis a2 = null;↵

4

            try {↵

3

            try {↵

5

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

4

                a2 = (ExtendedCategoryAxis) a1.clone();↵

6

            }↵

5

            }↵

7

            catch (CloneNotSupportedException e) {↵

6

            catch (CloneNotSupportedException e) {↵

8

                e.printStackTrace();↵

7

                e.printStackTrace();↵

9

            }↵

8

            }↵

10

            assertTrue(r1 != r2);↵

9

            assertTrue(a1 != a2);↵

11

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

10

            assertTrue(a1.getClass() == a2.getClass());↵

12

            assertTrue(r1.equals(r2));↵

11

            assertTrue(a1.equals(a2));↵

13

            ↵

12

            ↵

14

            r1.setSeriesFilled(1, true↵

13

            // check independence↵

15

    );↵

14

            a1.addSubLabel("C1", "ABC");↵

16

            assertFalse(r1.equals(r2));↵

15

            assertFalse(a1.equals(a2));↵

17

            r2.setSeriesFilled(1, true);↵

16

            a2.addSubLabel("C1", "ABC");↵

18

            assertTrue(r1.equals(r2));

17

            assertTrue(a1.equals(a2));

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

1. {Non-refactorable}

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

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

   1

       ExtendedCategoryAxis a1 = new ExtendedCategoryAxis("Test");

   1

       DefaultPolarItemRenderer r1 = new DefaultPolarItemRenderer();

   2

       ExtendedCategoryAxis a2 = null;

   2

       DefaultPolarItemRenderer r2 = null;

   3

       try

   3

       try

   4 | a2 = (ExtendedCategoryAxis)a1.clone();

   Preondition Violations
   Unmatched statement a2=(ExtendedCategoryAxis)a1.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted

   4

       a2 = (ExtendedCategoryAxis)a1.clone();

   4

       r2 = (DefaultPolarItemRenderer)r1.clone();

   4 | r2 = (DefaultPolarItemRenderer)r1.clone();

   Preondition Violations
   Unmatched statement r2=(DefaultPolarItemRenderer)r1.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted

   5

       assertTrue(r1 != r2);

   5 | assertTrue(r1 != r2);
   11 | assertTrue(a1.equals(a2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   r1 != r2 | a1.equals(a2) | TYPE_COMPATIBLE_REPLACEMENT

   Preondition Violations
   Expression a1.equals(a2) cannot be parameterized, because it has dependencies to/from statements that will be extracted

   11

       assertTrue(a1.equals(a2));

   6

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

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

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

   7

       assertTrue(a1.equals(a2));

   7

       assertTrue(r1.equals(r2));

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

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

   6

       assertTrue(a1.getClass() == a2.getClass());

   8

       r1.setSeriesFilled(1, true);

   8 | r1.setSeriesFilled(1, true);
   5 | assertTrue(a1 != a2);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setSeriesFilled | assertTrue | METHOD_INVOCATION_NAME_MISMATCH
   r1.setSeriesFilled(1,true) | assertTrue(a1 != a2) | ARGUMENT_NUMBER_MISMATCH
   r1 |  | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression r1.setSeriesFilled(1,true) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(a1 != a2) is a void method call, and thus it cannot be parameterized
   Expression r1.setSeriesFilled(1,true) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(a1 != a2) is a void method call, and thus it cannot be parameterized

   5

       assertTrue(a1 != a2);

   8 | a1.addSubLabel("C1", "ABC");

   Preondition Violations
   Unmatched statement a1.addSubLabel("C1","ABC"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   8

       a1.addSubLabel("C1", "ABC");

   9

       assertFalse(r1.equals(r2));

   9 | assertFalse(r1.equals(r2));
   9 | assertFalse(a1.equals(a2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   r2 | a2 | VARIABLE_NAME_MISMATCH
   org.jfree.chart.renderer.DefaultPolarItemRenderer | org.jfree.chart.axis.ExtendedCategoryAxis | VARIABLE_TYPE_MISMATCH
   r1 | a1 | VARIABLE_NAME_MISMATCH
   org.jfree.chart.renderer.DefaultPolarItemRenderer | org.jfree.chart.axis.ExtendedCategoryAxis | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.jfree.chart.renderer.DefaultPolarItemRenderer of variable r2 does not match with type org.jfree.chart.axis.ExtendedCategoryAxis of variable a2
   - Make classes org.jfree.chart.renderer.DefaultPolarItemRenderer and org.jfree.chart.axis.ExtendedCategoryAxis extend a common superclass

   Type org.jfree.chart.renderer.DefaultPolarItemRenderer of variable r1 does not match with type org.jfree.chart.axis.ExtendedCategoryAxis of variable a1
   - Make classes org.jfree.chart.renderer.DefaultPolarItemRenderer and org.jfree.chart.axis.ExtendedCategoryAxis extend a common superclass

   9

       assertFalse(a1.equals(a2));

   10

       r2.setSeriesFilled(1, true);

   11

       assertTrue(r1.equals(r2));

   11 | assertTrue(r1.equals(r2));
   10 | a2.addSubLabel("C1", "ABC");

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertTrue | addSubLabel | METHOD_INVOCATION_NAME_MISMATCH
   assertTrue(r1.equals(r2)) | a2.addSubLabel("C1","ABC") | ARGUMENT_NUMBER_MISMATCH
   | a2 | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression assertTrue(r1.equals(r2)) is a void method call, and thus it cannot be parameterized
   Expression a2.addSubLabel("C1","ABC") is a void method call, and thus it cannot be parameterized
   Expression assertTrue(r1.equals(r2)) is a void method call, and thus it cannot be parameterized
   Expression a2.addSubLabel("C1","ABC") is a void method call, and thus it cannot be parameterized

   10

       a2.addSubLabel("C1", "ABC");

   Precondition Violations (14)
   Row | Violation
   --- | ---
   1 | Unmatched statement a2=(ExtendedCategoryAxis)a1.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
   2 | Unmatched statement r2=(DefaultPolarItemRenderer)r1.clone(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted
   3 | Expression a1.equals(a2) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   4 | Expression r1.setSeriesFilled(1,true) is a void method call, and thus it cannot be parameterized
   5 | Expression assertTrue(a1 != a2) is a void method call, and thus it cannot be parameterized
   6 | Expression r1.setSeriesFilled(1,true) is a void method call, and thus it cannot be parameterized
   7 | Expression assertTrue(a1 != a2) is a void method call, and thus it cannot be parameterized
   8 | Unmatched statement a1.addSubLabel("C1","ABC"); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   9 | Type org.jfree.chart.renderer.DefaultPolarItemRenderer of variable r2 does not match with type org.jfree.chart.axis.ExtendedCategoryAxis of variable a2
   10 | Type org.jfree.chart.renderer.DefaultPolarItemRenderer of variable r1 does not match with type org.jfree.chart.axis.ExtendedCategoryAxis of variable a1
   11 | Expression assertTrue(r1.equals(r2)) is a void method call, and thus it cannot be parameterized
   12 | Expression a2.addSubLabel("C1","ABC") is a void method call, and thus it cannot be parameterized
   13 | Expression assertTrue(r1.equals(r2)) is a void method call, and thus it cannot be parameterized
   14 | Expression a2.addSubLabel("C1","ABC") is a void method call, and thus it cannot be parameterized