156-1-2

AbstractCategoryItemRenderer r1 = new BarRenderer(); r1.setItemLabelGenerator(new StandardCategoryItemLabelGenerator()); AbstractCategoryItemRenderer r2 = null; try { r2 = (BarRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); r1 = new BarRenderer(); r1.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator()); r2 = null; try { r2 = (BarRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); r1 = new BarRenderer(); r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator()); r2 = null; try { r2 = (BarRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2));
BarRenderer r1 = new BarRenderer(); r1.setItemLabelGenerator(new IntervalCategoryItemLabelGenerator()); BarRenderer r2 = null; try { r2 = (BarRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); r1 = new BarRenderer(); r1.setSeriesItemLabelGenerator(0, new IntervalCategoryItemLabelGenerator()); r2 = null; try { r2 = (BarRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } assertTrue(r1 != r2); assertTrue(r1.getClass() == r2.getClass()); assertTrue(r1.equals(r2)); r1 = new BarRenderer(); r1.setBaseItemLabelGenerator(new IntervalCategoryItemLabelGenerator()); r2 = null; try { r2 = (BarRenderer) r1.clone(); } catch (CloneNotSupportedException e) { e.printStackTrace(); } 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/AbstractCategoryItemRendererTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/category/junit/AbstractCategoryItemRendererTests.java
Method name: `void testCloning1()` |  | Method name: `void testCloning2()`
Number of AST nodes: 24 |  | Number of AST nodes: 24

1

    AbstractCategoryItemRenderer r1 = new BarRenderer();↵

1

    BarRenderer r1 = new BarRenderer();↵

2

            r1.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());↵

2

            r1.setItemLabelGenerator(new IntervalCategoryItemLabelGenerator());↵

3

            AbstractCategoryItemRenderer r2 = null;↵

3

            BarRenderer r2 = null;↵

4

            try {↵

4

            try {↵

5

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

5

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

6

            }↵

6

            }↵

7

            catch (CloneNotSupportedException e) {↵

7

            catch (CloneNotSupportedException e) {↵

8

                e.printStackTrace();↵

8

                e.printStackTrace();↵

9

            }↵

9

            }↵

10

            assertTrue(r1 != r2);↵

10

            assertTrue(r1 != r2);↵

11

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

11

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

12

            assertTrue(r1.equals(r2));↵

12

            assertTrue(r1.equals(r2));↵

13

            ↵

13

            ↵

14

            r1 = new BarRenderer();↵

14

            r1 = new BarRenderer();↵

15

            r1.setSeriesItemLabelGenerator(0, ↵

15

            r1.setSeriesItemLabelGenerator(0, ↵

16

                    new StandardCategoryItemLabelGenerator());↵

16

                    new IntervalCategoryItemLabelGenerator());↵

17

            r2 = null;↵

17

            r2 = null;↵

18

            try {↵

18

            try {↵

19

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

19

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

20

            }↵

20

            }↵

21

            catch (CloneNotSupportedException e) {↵

21

            catch (CloneNotSupportedException e) {↵

22

                e.printStackTrace();↵

22

                e.printStackTrace();↵

23

            }↵

23

            }↵

24

            assertTrue(r1 != r2);↵

24

            assertTrue(r1 != r2);↵

25

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

25

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

26

            assertTrue(r1.equals(r2));↵

26

            assertTrue(r1.equals(r2));↵

27

            ↵

27

            ↵

28

            r1 = new BarRenderer();↵

28

            r1 = new BarRenderer();↵

29

            r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());↵

29

            r1.setBaseItemLabelGenerator(new IntervalCategoryItemLabelGenerator());↵

30

            r2 = null;↵

30

            r2 = null;↵

31

            try {↵

31

            try {↵

32

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

32

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

33

            }↵

33

            }↵

34

            catch (CloneNotSupportedException e) {↵

34

            catch (CloneNotSupportedException e) {↵

35

                e.printStackTrace();↵

35

                e.printStackTrace();↵

36

            }↵

36

            }↵

37

            assertTrue(r1 != r2);↵

37

            assertTrue(r1 != r2);↵

38

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

38

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

39

            assertTrue(r1.equals(r2));

39

            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.7
Clones location | Clones are declared in the same class
Number of node comparisons | 93

1. {Non-refactorable}

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

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

   1

       AbstractCategoryItemRenderer r1 = new BarRenderer();

   1 | AbstractCategoryItemRenderer r1 = new BarRenderer();
   1 | BarRenderer r1 = new BarRenderer();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   1

       BarRenderer r1 = new BarRenderer();

   2

       r1.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());

   2 | r1.setItemLabelGenerator(new StandardCategoryItemLabelGenerator());
   2 | r1.setItemLabelGenerator(new IntervalCategoryItemLabelGenerator());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.labels.StandardCategoryItemLabelGenerator | org.jfree.chart.labels.IntervalCategoryItemLabelGenerator | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   2

       r1.setItemLabelGenerator(new IntervalCategoryItemLabelGenerator());

   3

       AbstractCategoryItemRenderer r2 = null;

   3 | AbstractCategoryItemRenderer r2 = null;
   3 | BarRenderer r2 = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   3

       BarRenderer r2 = null;

   4

       try

   4

       try

   5

       r2 = (BarRenderer)r1.clone();

   5 | r2 = (BarRenderer)r1.clone();
   5 | r2 = (BarRenderer)r1.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   5

       r2 = (BarRenderer)r1.clone();

   6

       assertTrue(r1 != r2);

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   6

       assertTrue(r1 != r2);

   7

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

   7 | assertTrue(r1.getClass() == r2.getClass());
   10 | r1.setSeriesItemLabelGenerator(0, new IntervalCategoryItemLabelGenerator());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   assertTrue | setSeriesItemLabelGenerator | METHOD_INVOCATION_NAME_MISMATCH
   assertTrue(r1.getClass() == r2.getClass()) | r1.setSeriesItemLabelGenerator(0,new IntervalCategoryItemLabelGenerator()) | ARGUMENT_NUMBER_MISMATCH
   | r1 | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression assertTrue(r1.getClass() == r2.getClass()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression r1.setSeriesItemLabelGenerator(0,new IntervalCategoryItemLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertTrue(r1.getClass() == r2.getClass()) is a void method call, and thus it cannot be parameterized
   Expression r1.setSeriesItemLabelGenerator(0,new IntervalCategoryItemLabelGenerator()) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(r1.getClass() == r2.getClass()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression r1.setSeriesItemLabelGenerator(0,new IntervalCategoryItemLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertTrue(r1.getClass() == r2.getClass()) is a void method call, and thus it cannot be parameterized
   Expression r1.setSeriesItemLabelGenerator(0,new IntervalCategoryItemLabelGenerator()) is a void method call, and thus it cannot be parameterized

   10

       r1.setSeriesItemLabelGenerator(0, new IntervalCategoryItemLabelGenerator());

   8

       assertTrue(r1.equals(r2));

   8 | assertTrue(r1.equals(r2));
   8 | assertTrue(r1.equals(r2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   8

       assertTrue(r1.equals(r2));

   9

       r1 = new BarRenderer();

   9 | r1 = new BarRenderer();
   9 | r1 = new BarRenderer();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   9

       r1 = new BarRenderer();

   10

       r1.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator());

   10 | r1.setSeriesItemLabelGenerator(0, new StandardCategoryItemLabelGenerator());
   7 | assertTrue(r1.getClass() == r2.getClass());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   setSeriesItemLabelGenerator | assertTrue | METHOD_INVOCATION_NAME_MISMATCH
   r1.setSeriesItemLabelGenerator(0,new StandardCategoryItemLabelGenerator()) | assertTrue(r1.getClass() == r2.getClass()) | ARGUMENT_NUMBER_MISMATCH
   r1 |  | MISSING_METHOD_INVOCATION_EXPRESSION

   Preondition Violations
   Expression r1.setSeriesItemLabelGenerator(0,new StandardCategoryItemLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertTrue(r1.getClass() == r2.getClass()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression r1.setSeriesItemLabelGenerator(0,new StandardCategoryItemLabelGenerator()) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(r1.getClass() == r2.getClass()) is a void method call, and thus it cannot be parameterized
   Expression r1.setSeriesItemLabelGenerator(0,new StandardCategoryItemLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression assertTrue(r1.getClass() == r2.getClass()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   Expression r1.setSeriesItemLabelGenerator(0,new StandardCategoryItemLabelGenerator()) is a void method call, and thus it cannot be parameterized
   Expression assertTrue(r1.getClass() == r2.getClass()) is a void method call, and thus it cannot be parameterized

   7

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

   11

       r2 = null;

   11 | r2 = null;
   11 | r2 = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   11

       r2 = null;

   12

       try

   12

       try

   13

       r2 = (BarRenderer)r1.clone();

   13 | r2 = (BarRenderer)r1.clone();
   13 | r2 = (BarRenderer)r1.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   13

       r2 = (BarRenderer)r1.clone();

   14

       assertTrue(r1 != r2);

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   14

       assertTrue(r1 != r2);

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

   Preondition Violations
   Unmatched statement assertTrue(r1.getClass() == r2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   15

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

   15

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

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

   Preondition Violations
   Unmatched statement assertTrue(r1.getClass() == r2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted

   16

       assertTrue(r1.equals(r2));

   16 | assertTrue(r1.equals(r2));
   16 | assertTrue(r1.equals(r2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   16

       assertTrue(r1.equals(r2));

   17

       r1 = new BarRenderer();

   17 | r1 = new BarRenderer();
   17 | r1 = new BarRenderer();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   17

       r1 = new BarRenderer();

   18

       r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());

   18 | r1.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());
   18 | r1.setBaseItemLabelGenerator(new IntervalCategoryItemLabelGenerator());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.labels.StandardCategoryItemLabelGenerator | org.jfree.chart.labels.IntervalCategoryItemLabelGenerator | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   18

       r1.setBaseItemLabelGenerator(new IntervalCategoryItemLabelGenerator());

   19

       r2 = null;

   19 | r2 = null;
   19 | r2 = null;

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   19

       r2 = null;

   20

       try

   20

       try

   21

       r2 = (BarRenderer)r1.clone();

   21 | r2 = (BarRenderer)r1.clone();
   21 | r2 = (BarRenderer)r1.clone();

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   21

       r2 = (BarRenderer)r1.clone();

   22

       assertTrue(r1 != r2);

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

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   22

       assertTrue(r1 != r2);

   23

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

   23

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

   24

       assertTrue(r1.equals(r2));

   24 | assertTrue(r1.equals(r2));
   24 | assertTrue(r1.equals(r2));

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH
   org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | org.jfree.chart.renderer.category.BarRenderer | SUBCLASS_TYPE_MISMATCH

   24

       assertTrue(r1.equals(r2));

   Precondition Violations (19)
   Row | Violation
   --- | ---
   1 | Expression assertTrue(r1.getClass() == r2.getClass()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   2 | Expression r1.setSeriesItemLabelGenerator(0,new IntervalCategoryItemLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   3 | Expression assertTrue(r1.getClass() == r2.getClass()) is a void method call, and thus it cannot be parameterized
   4 | Expression r1.setSeriesItemLabelGenerator(0,new IntervalCategoryItemLabelGenerator()) is a void method call, and thus it cannot be parameterized
   5 | Expression assertTrue(r1.getClass() == r2.getClass()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   6 | Expression r1.setSeriesItemLabelGenerator(0,new IntervalCategoryItemLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   7 | Expression assertTrue(r1.getClass() == r2.getClass()) is a void method call, and thus it cannot be parameterized
   8 | Expression r1.setSeriesItemLabelGenerator(0,new IntervalCategoryItemLabelGenerator()) is a void method call, and thus it cannot be parameterized
   9 | Expression r1.setSeriesItemLabelGenerator(0,new StandardCategoryItemLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   10 | Expression assertTrue(r1.getClass() == r2.getClass()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   11 | Expression r1.setSeriesItemLabelGenerator(0,new StandardCategoryItemLabelGenerator()) is a void method call, and thus it cannot be parameterized
   12 | Expression assertTrue(r1.getClass() == r2.getClass()) is a void method call, and thus it cannot be parameterized
   13 | Expression r1.setSeriesItemLabelGenerator(0,new StandardCategoryItemLabelGenerator()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   14 | Expression assertTrue(r1.getClass() == r2.getClass()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
   15 | Expression r1.setSeriesItemLabelGenerator(0,new StandardCategoryItemLabelGenerator()) is a void method call, and thus it cannot be parameterized
   16 | Expression assertTrue(r1.getClass() == r2.getClass()) is a void method call, and thus it cannot be parameterized
   17 | Unmatched statement assertTrue(r1.getClass() == r2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   18 | Unmatched statement assertTrue(r1.getClass() == r2.getClass()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
   19 | Clone fragment #1 returns variables r1, r2 , while Clone fragment #2 returns variables r1, r2