File path: /jfreechart-1.0.10/tests/org/jfree/chart/plot/junit/FastScatterPlotTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/chart/renderer/xy/junit/XYStepRendererTests.java | |||
Method name: void testCloning()
|
Method name: void testCloning()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | FastScatterPlot p1 = new FastScatterPlot();↵ | |||
2 | FastScatterPlot p↵ | 1 | XYStepRenderer r1 = new XYStepRenderer();↵ | |
3 | 2 = null;↵ | 2 | XYStepRenderer r2 = null;↵ | |
4 | try {↵ | 3 | try {↵ | |
5 | p2 = (FastScatterPlot) p1.clone();↵ | 4 | r2 = (XYStepRenderer) r1.clone();↵ | |
6 | }↵ | 5 | }↵ | |
7 | catch (CloneNotSupportedException e) {↵ | 6 | catch (CloneNotSupportedException e) {↵ | |
8 | e.printStackTrace();↵ | |||
9 | System.err.println("Failed to clone.");↵ | 7 | System.err.println("Failed to clone.");↵ | |
10 | }↵ | 8 | }↵ | |
11 | assertTrue(p1 != p2);↵ | 9 | assertTrue(r1 != r2);↵ | |
12 | assertTrue(p1.getClass() == p2.getClass());↵ | 10 | assertTrue(r1.getClass() == r2.getClass());↵ | |
13 | assertTrue(p1.equals(p2)); | 11 | assertTrue(r1.equals(r2)); | |
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 | 18 |
Number of mapped statements | 5 |
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) | 208.2 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | FastScatterPlot p1 = new FastScatterPlot(); |
| 1 | XYStepRenderer r1 = new XYStepRenderer(); | ||||||||||||||||||||||
2 | FastScatterPlot p2 = null; |
| 2 | XYStepRenderer r2 = null; | ||||||||||||||||||||||
| 3 | try | ||||||||||||||||||||||||
|
| 4 | r2 = (XYStepRenderer)r1.clone(); | |||||||||||||||||||||||
3 | try | | ||||||||||||||||||||||||
4 | p2 = (FastScatterPlot)p1.clone(); |
| | |||||||||||||||||||||||
5 | assertTrue(p1 != p2); |
| 5 | assertTrue(r1 != r2); | ||||||||||||||||||||||
6 | assertTrue(p1.getClass() == p2.getClass()); |
| 6 | assertTrue(r1.getClass() == r2.getClass()); | ||||||||||||||||||||||
7 | assertTrue(p1.equals(p2)); |
| 7 | assertTrue(r1.equals(r2)); |
Row | Violation |
---|---|
1 | Expression new FastScatterPlot() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement r2=(XYStepRenderer)r1.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement p2=(FastScatterPlot)p1.clone(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Expression p2 cannot be unified with expression r2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object) |
5 | Expression p2 cannot be unified with expression r2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
6 | Expression p1 cannot be unified with expression r1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
7 | Clone fragment #1 returns variables p1, p2 , while Clone fragment #2 returns variables r1, r2 |