f.setRefid(new Reference("dummy")); try { f.getDir(project); fail("Can make FileList a Reference to itself."); } catch (BuildException be) { assertEquals("This data type contains a circular reference.", be.getMessage()); }
p.setRefid(new Reference("dummy")); try { p.getIncludePatterns(project); fail("Can make PatternSet a Reference to itself."); } catch (BuildException be) { assertEquals("This data type contains a circular reference.", be.getMessage()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/FileListTest.java File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/ant/types/PatternSetTest.java
Method name: void testCircularReferenceCheck() Method name: void testCircularReferenceCheck()
Number of AST nodes: 4 Number of AST nodes: 4
1
f.setRefid(new Reference("dummy"));
1
p.setRefid(new Reference("dummy"));
2
        try {
2
        try {
3
            f.getDir(project);
3
            p.getIncludePatterns(project);
4
            fail("Can make FileList a Reference to itself.");
4
            fail("Can make PatternSet 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
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes having the same super class
Number of node comparisons10
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements3
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)12.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    f.setRefid(new Reference("dummy"));
    3
    f.setRefid(new Reference("dummy"));
    3
    p.setRefid(new Reference("dummy"));
    Differences
    Expression1Expression2Difference
    fpVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.types.FileListorg.apache.tools.ant.types.PatternSetSUBCLASS_TYPE_MISMATCH
    3
    p.setRefid(new Reference("dummy"));
    4
    try
    4
    try
                                                                      
    5
    p.getIncludePatterns(project);
    Preondition Violations
    Unmatched statement p.getIncludePatterns(project); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched statement p.getIncludePatterns(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
    5
    p.getIncludePatterns(project);
    5
    f.getDir(project);
    5
    f.getDir(project);
    Preondition Violations
    Unmatched statement f.getDir(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
                                              
    6
    fail("Can make FileList a Reference to itself.");
    6
    fail("Can make FileList a Reference to itself.");
    6
    fail("Can make PatternSet a Reference to itself.");
    Differences
    Expression1Expression2Difference
    "Can make FileList a Reference to itself.""Can make PatternSet a Reference to itself."LITERAL_VALUE_MISMATCH
    6
    fail("Can make PatternSet a Reference to itself.");
    Precondition Violations (4)
    Row Violation
    1Unmatched statement p.getIncludePatterns(project); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement p.getIncludePatterns(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
    3Unmatched statement f.getDir(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
    4The refactoring of the clones is infeasible, because classes org.apache.tools.ant.types.FileListTest and org.apache.tools.ant.types.PatternSetTest do not have a common superclass