try { m.getImplementation(); fail("Can make Mapper a Reference to itself."); } catch (BuildException be) { assertEquals("This data type contains a circular reference.", be.getMessage()); } // dummy1 --> dummy2 --> dummy3 --> dummy1 Mapper m1 = new Mapper(project);
try { m1.getImplementation(); fail("Can make circular reference."); } catch (BuildException be) { assertEquals("This data type contains a circular reference.", be.getMessage()); } // dummy1 --> dummy2 --> dummy3 // (which holds a glob mapper from "*.java" to "*.class" m1 = new Mapper(project);
Clone fragments detected by clone detection tool
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/MapperTest.java
Method name: void testCircularReferenceCheck() Method name: void testCircularReferenceCheck()
Number of AST nodes: 4 Number of AST nodes: 4
1
try {
1
try {
2
            m.getImplementation();
2
            m1.getImplementation();
3
            fail("Can make Mapper a Reference to itself.");
3
            fail("Can make circular reference.");
4
        } catch (BuildException be) {
4
        } catch (BuildException be) {
5
            assertEquals("This data type contains a circular reference.",
5
            assertEquals("This data type contains a circular reference.",
6
                         be.getMessage());
6
                         be.getMessage());
7
        }
7
        }
8
        // dummy1 --> dummy2 --> dummy3 --> dummy1
8
        // dummy1 --> dummy2 --> dummy3
9
        Mapper
9
        // (which holds a glob mapper from "*.java" to "*.class"
10
 m1 = new Mapper(project);
10
        m1 = new Mapper(project);
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 the same method
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)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    4
    try
    16
    try
    5
    m.getImplementation();
    5
    m.getImplementation();
    17
    m1.getImplementation();
    Differences
    Expression1Expression2Difference
    mm1VARIABLE_NAME_MISMATCH
    17
    m1.getImplementation();
    6
    fail("Can make Mapper a Reference to itself.");
    6
    fail("Can make Mapper a Reference to itself.");
    18
    fail("Can make circular reference.");
    Differences
    Expression1Expression2Difference
    "Can make Mapper a Reference to itself.""Can make circular reference."LITERAL_VALUE_MISMATCH
    18
    fail("Can make circular reference.");
    7
    Mapper m1 = new Mapper(project);
                                                                      
                                                          
    19
    m1 = new Mapper(project);
    Preondition Violations
    Unmatched statement m1=new Mapper(project); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    19
    m1 = new Mapper(project);
    Precondition Violations (1)
    Row Violation
    1Unmatched statement m1=new Mapper(project); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted