115-14-24

CategoryPointerAnnotation a1 = new CategoryPointerAnnotation("Label", "A", 20.0, Math.PI); CategoryPointerAnnotation a2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(a1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( buffer.toByteArray())); a2 = (CategoryPointerAnnotation) in.readObject(); in.close(); } catch (Exception e) { e.printStackTrace(); } assertEquals(a1, a2);
XYPointerAnnotation a1 = new XYPointerAnnotation("Label", 10.0, 20.0, Math.PI); XYPointerAnnotation a2 = null; try { ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ObjectOutput out = new ObjectOutputStream(buffer); out.writeObject(a1); out.close(); ObjectInput in = new ObjectInputStream(new ByteArrayInputStream( buffer.toByteArray())); a2 = (XYPointerAnnotation) in.readObject(); in.close(); } catch (Exception e) { System.out.println(e.toString()); } assertEquals(a1, a2);

Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/tests/org/jfree/chart/annotations/junit/CategoryPointerAnnotationTests.java |  | File path: /jfreechart-1.0.10/tests/org/jfree/chart/annotations/junit/XYPointerAnnotationTests.java
Method name: `void testSerialization()` |  | Method name: `void testSerialization()`
Number of AST nodes: 11 |  | Number of AST nodes: 11

1

    CategoryPointerAnnotation a1 = new CategoryPointerAnnotation("Label",↵

1

    XYPointerAnnotation a1 = new XYPointerAnnotation("Label",↵

2

      ↵

2

     10.0, 20.0,↵

3

                  "A", 20.0, Math.PI);↵

3

                    Math.PI);↵

4

            CategoryPointerAnnotation a2 = null;↵

4

            XYPointerAnnotation a2 = null;↵

5

            try {↵

5

            try {↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

6

                ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

7

                ObjectOutput out = new ObjectOutputStream(buffer);↵

8

                out.writeObject(a1);↵

8

                out.writeObject(a1);↵

9

                out.close();↵

9

                out.close();↵

10

                ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(↵

10

                ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(↵

11

                        buffer.toByteArray()));↵

11

                        buffer.toByteArray()));↵

12

                a2 = (CategoryPointerAnnotation) in.readObject();↵

12

                a2 = (XYPointerAnnotation) in.readObject();↵

13

                in.close();↵

13

                in.close();↵

14

            }↵

14

            }↵

15

            catch (Exception e) {↵

15

            catch (Exception e) {↵

16

                e.printStackTrace();↵

16

                System.out.println(e.toString());↵

17

            }↵

17

            }↵

18

            assertEquals(a1, a2);

18

            assertEquals(a1, a2);

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 0
Number of refactorable cases | 0
Number of non-refactorable cases | 0
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 | 1