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: 8 | Number of AST nodes: 8 | |||
1 | Path p = new Path(project);↵ | 1 | Mapper m = new Mapper(project);↵ | |
2 | project.addReference("dummy", p);↵ | 2 | project.addReference("dummy", m);↵ | |
3 | p.setRefid(new Reference("dummy"));↵ | 3 | m.setRefid(new Reference("dummy"));↵ | |
4 | try {↵ | 4 | try {↵ | |
5 | p.list();↵ | 5 | m.getImplementation();↵ | |
6 | fail("Can make Path a Reference to itself.");↵ | 6 | fail("Can make Mapper a Reference to itself.");↵ | |
7 | } catch (BuildException be) {↵ | 7 | } catch (BuildException be) {↵ | |
8 | assertEquals("This data type contains a circular reference.",↵ | 8 | assertEquals("This data type contains a circular reference.",↵ | |
9 | be.getMessage());↵ | 9 | be.getMessage());↵ | |
10 | }↵ | 10 | }↵ | |
11 | // dummy1 --> dummy2 --> dummy3 --> dummy1↵ | 11 | // dummy1 --> dummy2 --> dummy3 --> dummy1↵ | |
12 | Path p1 = new Path(project);↵ | 12 | Mapper m1 = new Mapper(project);↵ | |
13 | 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.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 20 |
Number of mapped statements | 7 |
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.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Path p = new Path(project); |
| 1 | Mapper m = new Mapper(project); | |||||||||||||||||||||
2 | project.addReference("dummy", p); |
| 2 | project.addReference("dummy", m); | |||||||||||||||||||||
3 | p.setRefid(new Reference("dummy")); |
| 3 | m.setRefid(new Reference("dummy")); | |||||||||||||||||||||
4 | try | 4 | try | ||||||||||||||||||||||
|
| 5 | m.getImplementation(); | ||||||||||||||||||||||
5 | p.list(); |
| | ||||||||||||||||||||||
6 | fail("Can make Path a Reference to itself."); |
| 6 | fail("Can make Mapper a Reference to itself."); | |||||||||||||||||||||
7 | Path p1 = new Path(project); |
| 7 | Mapper m1 = new Mapper(project); | |||||||||||||||||||||
8 | project.addReference("dummy1", p1); |
| 8 | project.addReference("dummy1", m1); |
Row | Violation |
---|---|
1 | Unmatched statement m.getImplementation(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement m.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 | Unmatched statement p.list(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Unmatched statement p.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 |
5 | Expression new Path(project) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | Expression new Mapper(project) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Clone fragment #1 returns variables p, p1 , while Clone fragment #2 returns variables m, m1 |