try {
f.getDir(project);
fail("Can make " + f.getDataTypeName()
+ " a Reference to itself.");
} catch (BuildException be) {
assertEquals("This data type contains a circular reference.",
be.getMessage());
}
try {
f.getDirectoryScanner(project);
fail("Can make " + f.getDataTypeName()
+ " a Reference to itself.");
} catch (BuildException be) {
assertEquals("This data type contains a circular reference.",
be.getMessage());
}
// dummy1 --> dummy2 --> dummy3 --> dummy1
AbstractFileSet f1 = getInstance();
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java
|
|
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/AbstractFileSetTest.java
|
Method name: void testCircularReferenceCheck()
|
|
Method name: void testCircularReferenceCheck()
|
Number of AST nodes: 3
|
|
Number of AST nodes: 4
|
|
1 | try {↵ | | 1 | try {↵
|
2 | f.getDir(project);↵ | | 2 | f.getDirectoryScanner(project);↵
|
3 | fail("Can make " + f.getDataTypeName()↵ | | 3 | fail("Can make " + f.getDataTypeName()↵
|
4 | + " a Reference to itself.");↵ | | 4 | + " a Reference to itself.");↵
|
5 | } catch (BuildException be) {↵ | | 5 | } catch (BuildException be) {↵
|
6 | assertEquals("This data type contains a circular reference.",↵ | | 6 | assertEquals("This data type contains a circular reference.",↵
|
7 | be.getMessage());↵ | | 7 | be.getMessage());↵
|
8 | } | | 8 | }↵
|
|
| | | 9 | // dummy1 --> dummy2 --> dummy3 --> dummy1↵
|
| | | 10 | AbstractFileSet f1 = getInstance();
|
See real code fragment |
|
See real code fragment |
Summary
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 the same method |
Number of node comparisons | 9 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 2 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 0.8 |
Clone type | Type 3 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
4 | try | | 7 | try |
5 | | | | |
| | | 8 | f.getDirectoryScanner(project); |
6 | fail("Can make " + f.getDataTypeName() + " a Reference to itself."); | | 9 | fail("Can make " + f.getDataTypeName() + " a Reference to itself."); |
| | | 10 | AbstractFileSet f1 = getInstance(); |
Precondition Violations (1)
Row |
Violation |
1 | Unmatched statement f.getDirectoryScanner(project); 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 |