File path: /jfreechart-1.0.10/tests/org/jfree/chart/annotations/junit/XYPolygonAnnotationTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/entity/junit/StandardEntityCollectionTests.java | |||
Method name: void testSerialization()
|
Method name: void testSerialization()
|
|||
Number of AST nodes: 12 | Number of AST nodes: 13 | |||
1 | Stroke stroke1 = new BasicStroke(2.0f);↵ | |||
2 | XYPolygonAnnotation a1 = new XYPolygonAnnotation(new double[] {1.0,↵ | 1 | PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0, ↵ | |
3 | 2.0, 3.0, 4.0, 5.0, 6.0}, stroke1, Color.red, Color.blue);↵ | 2 | 2.0, 3.0, 4.0), ↵ | |
4 | XYPolygonAnnota↵ | 3 | new DefaultPieDataset(), 0, 1, "Key", ↵ | |
4 | "ToolTip", "URL");↵ | |||
5 | StandardEntityCollection c1 = new StandardEntityCollection();↵ | |||
6 | c1.add(e1);↵ | |||
5 | tion a2 = null;↵ | 7 | StandardEntityCollection c2 = null;↵ | |
6 | try {↵ | 8 | try {↵ | |
7 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | 9 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | |
8 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | 10 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | |
9 | out.writeObject(a1);↵ | 11 | out.writeObject(c1);↵ | |
10 | out.close();↵ | 12 | out.close();↵ | |
11 | ObjectInput in = new ObjectInputStream(↵ | 13 | ObjectInput in = new ObjectInputStream(↵ | |
12 | new ByteArrayInputStream(↵ | 14 | new ByteArrayInputStream(↵ | |
13 | buffer.toByteArray())↵ | 15 | buffer.toByteArray())↵ | |
14 | );↵ | 16 | );↵ | |
15 | a2 = (XYPolygonAnnotation) in.readObject();↵ | 17 | c2 = (StandardEntityCollection) in.readObject();↵ | |
16 | in.close();↵ | 18 | in.close();↵ | |
17 | }↵ | 19 | }↵ | |
18 | catch (Exception e) {↵ | 20 | catch (Exception e) {↵ | |
19 | e.printStackTrace();↵ | 21 | e.printStackTrace();↵ | |
20 | }↵ | 22 | }↵ | |
21 | assertEquals(a1, a2); | 23 | assertEquals(c1, c2); | |
See real code fragment | See real code fragment |
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 | 79 |
Number of mapped statements | 11 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 32.8 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 1 | PieSectionEntity e1 = new PieSectionEntity(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), new DefaultPieDataset(), 0, 1, "Key", "ToolTip", "URL"); | |||||||||||||||||||||||||||
1 | Stroke stroke1 = new BasicStroke(2.0f); | | ||||||||||||||||||||||||||||
2 | XYPolygonAnnotation a1 = new XYPolygonAnnotation(new double[] {1.0, 2.0, 3.0, 4.0, 5.0, 6.0}, stroke1, Color.red, Color.blue); |
| 2 | StandardEntityCollection c1 = new StandardEntityCollection(); | ||||||||||||||||||||||||||
|
| 3 | c1.add(e1); | |||||||||||||||||||||||||||
3 | XYPolygonAnnotation a2 = null; |
| 4 | StandardEntityCollection c2 = null; | ||||||||||||||||||||||||||
4 | try | 5 | try | |||||||||||||||||||||||||||
5 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | 6 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | |||||||||||||||||||||||||||
6 | ObjectOutput out = new ObjectOutputStream(buffer); | 7 | ObjectOutput out = new ObjectOutputStream(buffer); | |||||||||||||||||||||||||||
7 | out.writeObject(a1); |
| 8 | out.writeObject(c1); | ||||||||||||||||||||||||||
8 | out.close(); | 9 | out.close(); | |||||||||||||||||||||||||||
9 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | 10 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | |||||||||||||||||||||||||||
10 | a2 = (XYPolygonAnnotation)in.readObject(); |
| 11 | c2 = (StandardEntityCollection)in.readObject(); | ||||||||||||||||||||||||||
11 | in.close(); | 12 | in.close(); | |||||||||||||||||||||||||||
12 | assertEquals(a1, a2); |
| 13 | assertEquals(c1, c2); |
Row | Violation |
---|---|
1 | Unmatched statement PieSectionEntity e1=new PieSectionEntity(new Rectangle2D.Double(1.0,2.0,3.0,4.0),new DefaultPieDataset(),0,1,"Key","ToolTip","URL"); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Expression new XYPolygonAnnotation(new double[]{1.0,2.0,3.0,4.0,5.0,6.0},stroke1,Color.red,Color.blue) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression new StandardEntityCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression new XYPolygonAnnotation(new double[]{1.0,2.0,3.0,4.0,5.0,6.0},stroke1,Color.red,Color.blue) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression new StandardEntityCollection() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Unmatched statement c1.add(e1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
7 | Expression a1 cannot be unified with expression c1 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public abstract void writeObject(java.lang.Object) throws java.io.IOException |
8 | Expression (XYPolygonAnnotation)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression (StandardEntityCollection)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression a1 cannot be unified with expression c1 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public static void assertEquals(java.lang.Object, java.lang.Object) |
11 | Expression a2 cannot be unified with expression c2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public static void assertEquals(java.lang.Object, java.lang.Object) |
12 | Clone fragment #1 returns variables , while Clone fragment #2 returns variables c1 |