File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/XYPlotTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/title/junit/LegendGraphicTests.java | |||
Method name: void testSerialization2()
|
Method name: void testSerialization()
|
|||
Number of AST nodes: 14 | Number of AST nodes: 13 | |||
1 | IntervalXYDataset data1 = createDataset1();↵ | |||
2 | XYItemRenderer renderer↵ | 1 | Stroke s = new BasicStroke(1.23f);↵ | |
3 | 1 = new XYBarRenderer(0.20);↵ | 2 | LegendGraphic g1 = new ↵ | |
4 | renderer1.setToolTipGenerator(↵ | |||
5 | StandardXYToolTipGenerator.getTimeSeriesInstance()↵ | |||
6 | );↵ | |||
7 | XYPlot p1 = new XYPlot(data1, new DateAxis("Date"), null, renderer1);↵ | |||
8 | XYPlot p↵ | 3 | LegendGraphic(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), Color.black);↵ | |
4 | g1.setOutlineStroke(s);↵ | |||
9 | 2 = null;↵ | 5 | LegendGraphic g2 = null;↵ | |
10 | try {↵ | 6 | try {↵ | |
11 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | 7 | ByteArrayOutputStream buffer = new ByteArrayOutputStream();↵ | |
12 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | 8 | ObjectOutput out = new ObjectOutputStream(buffer);↵ | |
13 | out.writeObject(p1);↵ | 9 | out.writeObject(g1);↵ | |
14 | out.close();↵ | 10 | out.close();↵ | |
15 | ObjectInput in = new ObjectInputStream(↵ | 11 | ObjectInput in = new ObjectInputStream(↵ | |
16 | new ByteArrayInputStream(buffer.toByteArray())↵ | 12 | new ByteArrayInputStream(buffer.toByteArray())↵ | |
17 | );↵ | 13 | );↵ | |
18 | p2 = (XYPlot) in.readObject();↵ | 14 | g2 = (LegendGraphic) in.readObject();↵ | |
19 | in.close();↵ | 15 | in.close();↵ | |
20 | }↵ | 16 | }↵ | |
21 | catch (Exception e) {↵ | 17 | catch (Exception e) {↵ | |
22 | fail(e.toString());↵ | 18 | System.out.println(e.toString());↵ | |
23 | }↵ | 19 | }↵ | |
24 | assertEquals(p1, p2); | 20 | assertTrue(g1.equals(g2)); | |
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.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 89 |
Number of mapped statements | 11 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 87.8 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Stroke s = new BasicStroke(1.23f); | ||||||||||||||||||||||||||||
1 | IntervalXYDataset data1 = createDataset1(); | | ||||||||||||||||||||||||||||
2 | XYItemRenderer renderer1 = new XYBarRenderer(0.20); |
| | |||||||||||||||||||||||||||
3 | renderer1.setToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); |
| | |||||||||||||||||||||||||||
4 | XYPlot p1 = new XYPlot(data1, new DateAxis("Date"), null, renderer1); |
| 2 | LegendGraphic g1 = new LegendGraphic(new Rectangle2D.Double(1.0, 2.0, 3.0, 4.0), Color.black); | ||||||||||||||||||||||||||
|
| 3 | g1.setOutlineStroke(s); | |||||||||||||||||||||||||||
5 | XYPlot p2 = null; |
| 4 | LegendGraphic g2 = null; | ||||||||||||||||||||||||||
6 | try |
| 5 | try | ||||||||||||||||||||||||||
7 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | 6 | ByteArrayOutputStream buffer = new ByteArrayOutputStream(); | |||||||||||||||||||||||||||
8 | ObjectOutput out = new ObjectOutputStream(buffer); | 7 | ObjectOutput out = new ObjectOutputStream(buffer); | |||||||||||||||||||||||||||
9 | out.writeObject(p1); |
| 8 | out.writeObject(g1); | ||||||||||||||||||||||||||
10 | out.close(); | 9 | out.close(); | |||||||||||||||||||||||||||
11 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | 10 | ObjectInput in = new ObjectInputStream(new ByteArrayInputStream(buffer.toByteArray())); | |||||||||||||||||||||||||||
12 | p2 = (XYPlot)in.readObject(); |
| 11 | g2 = (LegendGraphic)in.readObject(); | ||||||||||||||||||||||||||
13 | in.close(); | 12 | in.close(); | |||||||||||||||||||||||||||
14 | assertEquals(p1, p2); |
| 13 | assertTrue(g1.equals(g2)); |
Row | Violation |
---|---|
1 | Unmatched statement XYItemRenderer renderer1=new XYBarRenderer(0.20); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement renderer1.setToolTipGenerator(StandardXYToolTipGenerator.getTimeSeriesInstance()); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Expression new XYPlot(data1,new DateAxis("Date"),null,renderer1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression new LegendGraphic(new Rectangle2D.Double(1.0,2.0,3.0,4.0),Color.black) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression new XYPlot(data1,new DateAxis("Date"),null,renderer1) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression new LegendGraphic(new Rectangle2D.Double(1.0,2.0,3.0,4.0),Color.black) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Unmatched statement g1.setOutlineStroke(s); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | Expression fail(e.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression System.out.println(e.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression fail(e.toString()) is a void method call, and thus it cannot be parameterized |
11 | Expression System.out.println(e.toString()) is a void method call, and thus it cannot be parameterized |
12 | Expression fail(e.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
13 | Expression System.out.println(e.toString()) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression fail(e.toString()) is a void method call, and thus it cannot be parameterized |
15 | Expression System.out.println(e.toString()) is a void method call, and thus it cannot be parameterized |
16 | Expression p1 cannot be unified with expression g1 , 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 |
17 | Expression (XYPlot)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
18 | Expression (LegendGraphic)in.readObject() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Expression assertEquals(p1,p2) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
20 | Expression assertTrue(g1.equals(g2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
21 | Expression assertEquals(p1,p2) is a void method call, and thus it cannot be parameterized |
22 | Expression assertTrue(g1.equals(g2)) is a void method call, and thus it cannot be parameterized |
23 | Expression assertEquals(p1,p2) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
24 | Expression assertTrue(g1.equals(g2)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
25 | Expression assertEquals(p1,p2) is a void method call, and thus it cannot be parameterized |
26 | Expression assertTrue(g1.equals(g2)) is a void method call, and thus it cannot be parameterized |
27 | Clone fragment #1 returns variables , while Clone fragment #2 returns variables g1 |