File path: /jfreechart-1.0.10/tests/org/jfree/data/general/junit/DefaultPieDatasetTests.java | File path: /jfreechart-1.0.10/tests/org/jfree/data/junit/KeyedObjectsTests.java | |||
Method name: void testCloning()
|
Method name: void testCloning()
|
|||
Number of AST nodes: 10 | Number of AST nodes: 10 | |||
1 | DefaultPieDataset d1 = new DefaultPieDataset();↵ | |||
2 | d1.setValue↵ | 1 | KeyedObjects ko1 = new KeyedObjects();↵ | |
3 | ("V1", new Integer(1));↵ | 2 | ko1.addObject("V1", new Integer(1));↵ | |
4 | d1.setValue("V2", null);↵ | 3 | ko1.addObject("V2", null);↵ | |
5 | d1.setValue("V3", new Integer(3));↵ | 4 | ko1.addObject("V3", new Integer(3));↵ | |
6 | DefaultPieDataset d2 = null;↵ | 5 | KeyedObjects ko2 = null;↵ | |
7 | try {↵ | 6 | try {↵ | |
8 | d2 = (DefaultPieDataset) d1.clone();↵ | 7 | ko2 = (KeyedObjects) ko1.clone();↵ | |
9 | }↵ | 8 | }↵ | |
10 | catch (CloneNotSupportedException e) {↵ | 9 | catch (CloneNotSupportedException e) {↵ | |
11 | System.err.println("Failed to clone.");↵ | 10 | System.err.println("Failed to clone.");↵ | |
12 | }↵ | 11 | }↵ | |
13 | assertTrue(d1 != d2);↵ | 12 | assertTrue(ko1 != ko2);↵ | |
14 | assertTrue(d1.getClass() == d2.getClass());↵ | 13 | assertTrue(ko1.getClass() == ko2.getClass());↵ | |
15 | assertTrue(d1.equals(d2)); | 14 | assertTrue(ko1.equals(ko2)); | |
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.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 36 |
Number of mapped statements | 10 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 44.8 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | DefaultPieDataset d1 = new DefaultPieDataset(); |
| 1 | KeyedObjects ko1 = new KeyedObjects(); | ||||||||||||||||||||||||
2 | d1.setValue("V1", new Integer(1)); |
| 2 | ko1.addObject("V1", new Integer(1)); | ||||||||||||||||||||||||
3 | d1.setValue("V2", null); |
| 3 | ko1.addObject("V2", null); | ||||||||||||||||||||||||
4 | d1.setValue("V3", new Integer(3)); |
| 4 | ko1.addObject("V3", new Integer(3)); | ||||||||||||||||||||||||
5 | DefaultPieDataset d2 = null; |
| 5 | KeyedObjects ko2 = null; | ||||||||||||||||||||||||
6 | try | 6 | try | |||||||||||||||||||||||||
7 | d2 = (DefaultPieDataset)d1.clone(); |
| 7 | ko2 = (KeyedObjects)ko1.clone(); | ||||||||||||||||||||||||
8 | assertTrue(d1 != d2); |
| 8 | assertTrue(ko1 != ko2); | ||||||||||||||||||||||||
9 | assertTrue(d1.getClass() == d2.getClass()); |
| 9 | assertTrue(ko1.getClass() == ko2.getClass()); | ||||||||||||||||||||||||
10 | assertTrue(d1.equals(d2)); |
| 10 | assertTrue(ko1.equals(ko2)); |
Row | Violation |
---|---|
1 | Expression new DefaultPieDataset() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression new KeyedObjects() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression d1.setValue("V1",new Integer(1)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression ko1.addObject("V1",new Integer(1)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression d1.setValue("V1",new Integer(1)) is a void method call, and thus it cannot be parameterized |
6 | Expression ko1.addObject("V1",new Integer(1)) is a void method call, and thus it cannot be parameterized |
7 | Expression d1 cannot be unified with expression ko1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setValue(Comparable#RAW, java.lang.Number) , public void addObject(Comparable#RAW, java.lang.Object) |
8 | Expression d1.setValue("V2",null) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
9 | Expression ko1.addObject("V2",null) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression d1.setValue("V2",null) is a void method call, and thus it cannot be parameterized |
11 | Expression ko1.addObject("V2",null) is a void method call, and thus it cannot be parameterized |
12 | Expression d1 cannot be unified with expression ko1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setValue(Comparable#RAW, java.lang.Number) , public void addObject(Comparable#RAW, java.lang.Object) |
13 | Expression d1.setValue("V3",new Integer(3)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
14 | Expression ko1.addObject("V3",new Integer(3)) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
15 | Expression d1.setValue("V3",new Integer(3)) is a void method call, and thus it cannot be parameterized |
16 | Expression ko1.addObject("V3",new Integer(3)) is a void method call, and thus it cannot be parameterized |
17 | Expression d1 cannot be unified with expression ko1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public void setValue(Comparable#RAW, java.lang.Number) , public void addObject(Comparable#RAW, java.lang.Object) |
18 | Expression (DefaultPieDataset)d1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
19 | Expression (KeyedObjects)ko1.clone() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
20 | Expression d2 cannot be unified with expression ko2 , because common superclass type org.jfree.util.PublicCloneable cannot be passed as an argument to public boolean equals(java.lang.Object) |
21 | Expression d2 cannot be unified with expression ko2 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |
22 | Expression d1 cannot be unified with expression ko1 , because common superclass org.jfree.util.PublicCloneable does not declare member(s) public boolean equals(java.lang.Object) |