p.setLocation(new File("/a")); try { p.setRefid(new Reference("dummyref")); fail("Can add reference to Path with elements from setLocation"); } catch (BuildException be) { assertEquals("You must not specify more than one attribute when using refid", be.getMessage()); }
p.setRefid(new Reference("dummyref")); try { p.setIncludesfile(new File("/a")); fail("Can set includesfile in PatternSet that is a reference."); } catch (BuildException be) { assertEquals("You must not specify more than one attribute when using refid", be.getMessage()); }
Clone fragments detected by clone detection tool
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/PatternSetTest.java
Method name: void testEmptyElementIfIsReference() Method name: void testEmptyElementIfIsReference()
Number of AST nodes: 4 Number of AST nodes: 4
1
p.setLocation(new File("/a"));
1
p.setRefid(new Reference("dummyref"));
2
        try {
2
        try {
3
            p.setRefid(new Reference("dummyref"));
3
            p.set
4
            fail("Can add reference to Path with elements from setLocation
4
Includesfile(new File("/a"));
5
");
5
            fail("Can set includesfile in PatternSet that is a reference.");
6
        } catch (BuildException be) {
6
        } catch (BuildException be) {
7
            assertEquals("You must not specify more than one attribute when using refid",
7
            assertEquals("You must not specify more than one attribute when using refid",
8
                         be.getMessage());
8
                         be.getMessage());
9
        }
9
        }
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 statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)30.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    p.setLocation(new File("/a"));
    6
    p.setLocation(new File("/a"));
    12
    p.setRefid(new Reference("dummyref"));
    Differences
    Expression1Expression2Difference
    java.io.Fileorg.apache.tools.ant.types.ReferenceVARIABLE_TYPE_MISMATCH
    "/a""dummyref"LITERAL_VALUE_MISMATCH
    setLocationsetRefidMETHOD_INVOCATION_NAME_MISMATCH
    org.apache.tools.ant.types.Pathorg.apache.tools.ant.types.PatternSetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type java.io.File does not match with type org.apache.tools.ant.types.Reference
    • Make classes java.io.File and org.apache.tools.ant.types.Reference extend a common superclass
    Expression p.setLocation(new File("/a")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p.setRefid(new Reference("dummyref")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p.setLocation(new File("/a")) is a void method call, and thus it cannot be parameterized
    Expression p.setRefid(new Reference("dummyref")) is a void method call, and thus it cannot be parameterized
    Expression p cannot be unified with expression p , because common superclass org.apache.tools.ant.types.DataType does not declare member(s) public void setLocation(java.io.File) throws org.apache.tools.ant.BuildException
    12
    p.setRefid(new Reference("dummyref"));
    7
    try
    13
    try
    8
    p.setRefid(new Reference("dummyref"));
    8
    p.setRefid(new Reference("dummyref"));
    14
    p.setIncludesfile(new File("/a"));
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.types.Referencejava.io.FileVARIABLE_TYPE_MISMATCH
    "dummyref""/a"LITERAL_VALUE_MISMATCH
    setRefidsetIncludesfileMETHOD_INVOCATION_NAME_MISMATCH
    org.apache.tools.ant.types.Pathorg.apache.tools.ant.types.PatternSetSUBCLASS_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.types.Reference does not match with type java.io.File
    • Make classes org.apache.tools.ant.types.Reference and java.io.File extend a common superclass
    Expression p.setRefid(new Reference("dummyref")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p.setIncludesfile(new File("/a")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression p.setRefid(new Reference("dummyref")) is a void method call, and thus it cannot be parameterized
    Expression p.setIncludesfile(new File("/a")) is a void method call, and thus it cannot be parameterized
    Expression p cannot be unified with expression p , because common superclass org.apache.tools.ant.types.DataType does not declare member(s) public void setIncludesfile(java.io.File) throws org.apache.tools.ant.BuildException
    14
    p.setIncludesfile(new File("/a"));
    9
    fail("Can add reference to Path with elements from setLocation");
    9
    fail("Can add reference to Path with elements from setLocation");
    15
    fail("Can set includesfile in PatternSet that is a reference.");
    Differences
    Expression1Expression2Difference
    "Can add reference to Path with elements from setLocation""Can set includesfile in PatternSet that is a reference."LITERAL_VALUE_MISMATCH
    15
    fail("Can set includesfile in PatternSet that is a reference.");
    Precondition Violations (12)
    Row Violation
    1Type java.io.File does not match with type org.apache.tools.ant.types.Reference
    2Expression p.setLocation(new File("/a")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression p.setRefid(new Reference("dummyref")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression p.setLocation(new File("/a")) is a void method call, and thus it cannot be parameterized
    5Expression p.setRefid(new Reference("dummyref")) is a void method call, and thus it cannot be parameterized
    6Expression p cannot be unified with expression p , because common superclass org.apache.tools.ant.types.DataType does not declare member(s) public void setLocation(java.io.File) throws org.apache.tools.ant.BuildException
    7Type org.apache.tools.ant.types.Reference does not match with type java.io.File
    8Expression p.setRefid(new Reference("dummyref")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    9Expression p.setIncludesfile(new File("/a")) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression p.setRefid(new Reference("dummyref")) is a void method call, and thus it cannot be parameterized
    11Expression p.setIncludesfile(new File("/a")) is a void method call, and thus it cannot be parameterized
    12Expression p cannot be unified with expression p , because common superclass org.apache.tools.ant.types.DataType does not declare member(s) public void setIncludesfile(java.io.File) throws org.apache.tools.ant.BuildException