File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/MapperTest.java | File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/PathTest.java | |||
Method name: void testCircularReferenceCheck()
|
Method name: void testCircularReferenceCheck()
|
|||
Number of AST nodes: 7 | Number of AST nodes: 7 | |||
1 | project.addReference("dummy3", m3);↵ | 1 | project.addReference("dummy3", p3);↵ | |
2 | m3.setRefid(new Reference("dummy1"));↵ | 2 | p3.setRefid(new Reference("dummy1"));↵ | |
3 | try {↵ | 3 | try {↵ | |
4 | m1.getImplementation();↵ | 4 | p1.list();↵ | |
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↵ | 10 | // dummy1 --> dummy2 --> dummy3↵ | |
11 | // (which holds a glob mapper from "*.java" to "*.class"↵ | 11 | (with Path "/a")↵ | |
12 | m1 = new Mapper(project);↵ | 12 | p1 = new Path(project);↵ | |
13 | project.addReference("dummy1", m1); | 13 | project.addReference("dummy1", p1); | |
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) | 11.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
14 | project.addReference("dummy3", m3); |
| 12 | project.addReference("dummy3", p3); | ||||||||||||||||
15 | m3.setRefid(new Reference("dummy1")); |
| 13 | p3.setRefid(new Reference("dummy1")); | ||||||||||||||||
16 | try | 14 | try | |||||||||||||||||
| 15 | p1.list(); | ||||||||||||||||||
17 | m1.getImplementation(); |
| | |||||||||||||||||
18 | fail("Can make circular reference."); | 16 | fail("Can make circular reference."); | |||||||||||||||||
19 | m1 = new Mapper(project); |
| 17 | p1 = new Path(project); | ||||||||||||||||
20 | project.addReference("dummy1", m1); |
| 18 | project.addReference("dummy1", p1); |
Row | Violation |
---|---|
1 | 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 |
2 | Clone fragment #1 returns variable m1 with type org.apache.tools.ant.types.Mapper , while Clone fragment #2 returns variable p1 with type org.apache.tools.ant.types.Path |