File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/PathTest.java | File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/MapperTest.java | |||
Method name: void testCircularReferenceCheck()
|
Method name: void testCircularReferenceCheck()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | project.addReference("dummy3", p3);↵ | 1 | project.addReference("dummy3", m3);↵ | |
2 | p3.setRefid(new Reference("dummy1"));↵ | 2 | m3.setRefid(new Reference("dummy1"));↵ | |
3 | try {↵ | 3 | try {↵ | |
4 | p1.list();↵ | 4 | m1.getImplementation();↵ | |
5 | fail("Can make circular reference.");↵ | 5 | fail("Can make circular reference.");↵ | |
6 | } catch (BuildException be) {↵ | 6 | } catch (BuildException be) {↵ | |
7 | assertEquals("This data type contains a circular reference.",↵ | 7 | assertEquals("This data type contains a circular reference.",↵ | |
8 | be.getMessage());↵ | 8 | be.getMessage());↵ | |
9 | }↵ | 9 | }↵ | |
10 | // dummy1 --> dummy2 --> dummy3 (with Path "/a")↵ | 10 | // dummy1 --> dummy2 --> dummy3↵ | |
11 | // (which holds a glob mapper from "*.java" to "*.class"↵ | |||
11 | p1 = new Path(project);↵ | 12 | m1 = new Mapper(project);↵ | |
12 | project.addReference("dummy1", p1); | 13 | project.addReference("dummy1", m1); | |
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 | 25 |
Number of mapped statements | 6 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 34.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
12 | project.addReference("dummy3", p3); |
| 14 | project.addReference("dummy3", m3); | ||||||||||||||||||
13 | p3.setRefid(new Reference("dummy1")); |
| 15 | m3.setRefid(new Reference("dummy1")); | ||||||||||||||||||
14 | try | 16 | try | |||||||||||||||||||
15 | p1.list(); |
| | |||||||||||||||||||
|
| 17 | m1.getImplementation(); | |||||||||||||||||||
16 | fail("Can make circular reference."); | 18 | fail("Can make circular reference."); | |||||||||||||||||||
17 | p1 = new Path(project); |
| 19 | m1 = new Mapper(project); | ||||||||||||||||||
18 | project.addReference("dummy1", p1); |
| 20 | project.addReference("dummy1", m1); |
Row | Violation |
---|---|
1 | Unmatched statement p1.list(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
2 | Unmatched statement m1.getImplementation(); cannot be moved before or after the extracted code, because it throws exception(s) that should be caught by a try block that will be extracted |
3 | Expression new Path(project) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression new Mapper(project) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Clone fragment #1 returns variable p1 with type org.apache.tools.ant.types.Path , while Clone fragment #2 returns variable m1 with type org.apache.tools.ant.types.Mapper |