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