if (from.getValue() != null) { to.setValue(from.getValue()); } if (from.getFile() != null) { to.setFile(from.getFile()); } if (from.getResource() != null) { to.setResource(from.getResource()); } if (from.getPrefix() != null) { to.setPrefix(from.getPrefix()); } if (from.getRefid() != null) { to.setRefid(from.getRefid()); } if (from.getEnvironment() != null) { to.setEnvironment(from.getEnvironment()); }
if (from.getFile() != null) { to.setFile(from.getFile()); } if (from.getResource() != null) { to.setResource(from.getResource()); } if (from.getPrefix() != null) { to.setPrefix(from.getPrefix()); } if (from.getRefid() != null) { to.setRefid(from.getRefid()); } if (from.getEnvironment() != null) { to.setEnvironment(from.getEnvironment()); } if (from.getClasspath() != null) { to.setClasspath(from.getClasspath()); }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/SubAnt.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/SubAnt.java
Method name: void copyProperty(Property, Property) Method name: void copyProperty(Property, Property)
Number of AST nodes: 12 Number of AST nodes: 12
1
if (from.getValue() != null) {
2
            to.setValue(from.getValue());
3
        }
4
        if (from.getFile() != null) {
1
if (from.getFile() != null) {
5
            to.setFile(from.getFile());
2
            to.setFile(from.getFile());
6
        }
3
        }
7
        if (from.getResource() != null) {
4
        if (from.getResource() != null) {
8
            to.setResource(from.getResource());
5
            to.setResource(from.getResource());
9
        }
6
        }
10
        if (from.getPrefix() != null) {
7
        if (from.getPrefix() != null) {
11
            to.setPrefix(from.getPrefix());
8
            to.setPrefix(from.getPrefix());
12
        }
9
        }
13
        if (from.getRefid() != null) {
10
        if (from.getRefid() != null) {
14
            to.setRefid(from.getRefid());
11
            to.setRefid(from.getRefid());
15
        }
12
        }
16
        if (from.getEnvironment() != null) {
13
        if (from.getEnvironment() != null) {
17
            to.setEnvironment(from.getEnvironment());
14
            to.setEnvironment(from.getEnvironment());
18
        }
15
        }
16
        if (from.getClasspath() != null) {
17
            to.setClasspath(from.getClasspath());
18
        }
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)2.1
Clones locationClones are in the same method
Number of node comparisons99
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    2
    if (from.getValue() != null)
    2
    if (from.getValue() != null)
    4
    if (from.getFile() != null)
    Differences
    Expression1Expression2Difference
    getValuegetFileMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringjava.io.FileVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable from.getValue() does not match with type java.io.File of variable from.getFile()
    • Make classes java.lang.String and java.io.File extend a common superclass
    4
    if (from.getFile() != null)
    3
    to.setValue(from.getValue());
    3
    to.setValue(from.getValue());
    5
    to.setFile(from.getFile());
    Differences
    Expression1Expression2Difference
    setValuesetFileMETHOD_INVOCATION_NAME_MISMATCH
    getValuegetFileMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringjava.io.FileVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression to.setValue(from.getValue()) is a void method call, and thus it cannot be parameterized
    Expression to.setFile(from.getFile()) is a void method call, and thus it cannot be parameterized
    Type java.lang.String of variable from.getValue() does not match with type java.io.File of variable from.getFile()
    • Make classes java.lang.String and java.io.File extend a common superclass
    5
    to.setFile(from.getFile());
    4
    if (from.getFile() != null)
    4
    if (from.getFile() != null)
    6
    if (from.getResource() != null)
    Differences
    Expression1Expression2Difference
    getFilegetResourceMETHOD_INVOCATION_NAME_MISMATCH
    java.io.Filejava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.io.File of variable from.getFile() does not match with type java.lang.String of variable from.getResource()
    • Make classes java.io.File and java.lang.String extend a common superclass
    6
    if (from.getResource() != null)
    5
    to.setFile(from.getFile());
    5
    to.setFile(from.getFile());
    7
    to.setResource(from.getResource());
    Differences
    Expression1Expression2Difference
    setFilesetResourceMETHOD_INVOCATION_NAME_MISMATCH
    getFilegetResourceMETHOD_INVOCATION_NAME_MISMATCH
    java.io.Filejava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression to.setFile(from.getFile()) is a void method call, and thus it cannot be parameterized
    Expression to.setResource(from.getResource()) is a void method call, and thus it cannot be parameterized
    Type java.io.File of variable from.getFile() does not match with type java.lang.String of variable from.getResource()
    • Make classes java.io.File and java.lang.String extend a common superclass
    7
    to.setResource(from.getResource());
    6
    if (from.getResource() != null)
    6
    if (from.getResource() != null)
    8
    if (from.getPrefix() != null)
    Differences
    Expression1Expression2Difference
    getResourcegetPrefixMETHOD_INVOCATION_NAME_MISMATCH
    8
    if (from.getPrefix() != null)
    7
    to.setResource(from.getResource());
    7
    to.setResource(from.getResource());
    9
    to.setPrefix(from.getPrefix());
    Differences
    Expression1Expression2Difference
    setResourcesetPrefixMETHOD_INVOCATION_NAME_MISMATCH
    getResourcegetPrefixMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression to.setResource(from.getResource()) is a void method call, and thus it cannot be parameterized
    Expression to.setPrefix(from.getPrefix()) is a void method call, and thus it cannot be parameterized
    9
    to.setPrefix(from.getPrefix());
    8
    if (from.getPrefix() != null)
    8
    if (from.getPrefix() != null)
    10
    if (from.getRefid() != null)
    Differences
    Expression1Expression2Difference
    getPrefixgetRefidMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringorg.apache.tools.ant.types.ReferenceVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable from.getPrefix() does not match with type org.apache.tools.ant.types.Reference of variable from.getRefid()
    • Make classes java.lang.String and org.apache.tools.ant.types.Reference extend a common superclass
    10
    if (from.getRefid() != null)
    9
    to.setPrefix(from.getPrefix());
    9
    to.setPrefix(from.getPrefix());
    11
    to.setRefid(from.getRefid());
    Differences
    Expression1Expression2Difference
    setPrefixsetRefidMETHOD_INVOCATION_NAME_MISMATCH
    getPrefixgetRefidMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringorg.apache.tools.ant.types.ReferenceVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression to.setPrefix(from.getPrefix()) is a void method call, and thus it cannot be parameterized
    Expression to.setRefid(from.getRefid()) is a void method call, and thus it cannot be parameterized
    Type java.lang.String of variable from.getPrefix() does not match with type org.apache.tools.ant.types.Reference of variable from.getRefid()
    • Make classes java.lang.String and org.apache.tools.ant.types.Reference extend a common superclass
    11
    to.setRefid(from.getRefid());
    10
    if (from.getRefid() != null)
    10
    if (from.getRefid() != null)
    12
    if (from.getEnvironment() != null)
    Differences
    Expression1Expression2Difference
    getRefidgetEnvironmentMETHOD_INVOCATION_NAME_MISMATCH
    org.apache.tools.ant.types.Referencejava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.types.Reference of variable from.getRefid() does not match with type java.lang.String of variable from.getEnvironment()
    • Make classes org.apache.tools.ant.types.Reference and java.lang.String extend a common superclass
    12
    if (from.getEnvironment() != null)
    11
    to.setRefid(from.getRefid());
    11
    to.setRefid(from.getRefid());
    13
    to.setEnvironment(from.getEnvironment());
    Differences
    Expression1Expression2Difference
    setRefidsetEnvironmentMETHOD_INVOCATION_NAME_MISMATCH
    getRefidgetEnvironmentMETHOD_INVOCATION_NAME_MISMATCH
    org.apache.tools.ant.types.Referencejava.lang.StringVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression to.setRefid(from.getRefid()) is a void method call, and thus it cannot be parameterized
    Expression to.setEnvironment(from.getEnvironment()) is a void method call, and thus it cannot be parameterized
    Type org.apache.tools.ant.types.Reference of variable from.getRefid() does not match with type java.lang.String of variable from.getEnvironment()
    • Make classes org.apache.tools.ant.types.Reference and java.lang.String extend a common superclass
    13
    to.setEnvironment(from.getEnvironment());
    12
    if (from.getEnvironment() != null)
    12
    if (from.getEnvironment() != null)
    14
    if (from.getClasspath() != null)
    Differences
    Expression1Expression2Difference
    getEnvironmentgetClasspathMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringorg.apache.tools.ant.types.PathVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.lang.String of variable from.getEnvironment() does not match with type org.apache.tools.ant.types.Path of variable from.getClasspath()
    • Make classes java.lang.String and org.apache.tools.ant.types.Path extend a common superclass
    14
    if (from.getClasspath() != null)
    13
    to.setEnvironment(from.getEnvironment());
    13
    to.setEnvironment(from.getEnvironment());
    15
    to.setClasspath(from.getClasspath());
    Differences
    Expression1Expression2Difference
    setEnvironmentsetClasspathMETHOD_INVOCATION_NAME_MISMATCH
    getEnvironmentgetClasspathMETHOD_INVOCATION_NAME_MISMATCH
    java.lang.Stringorg.apache.tools.ant.types.PathVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression to.setEnvironment(from.getEnvironment()) is a void method call, and thus it cannot be parameterized
    Expression to.setClasspath(from.getClasspath()) is a void method call, and thus it cannot be parameterized
    Type java.lang.String of variable from.getEnvironment() does not match with type org.apache.tools.ant.types.Path of variable from.getClasspath()
    • Make classes java.lang.String and org.apache.tools.ant.types.Path extend a common superclass
    15
    to.setClasspath(from.getClasspath());
    Precondition Violations (22)
    Row Violation
    1Type java.lang.String of variable from.getValue() does not match with type java.io.File of variable from.getFile()
    2Expression to.setValue(from.getValue()) is a void method call, and thus it cannot be parameterized
    3Expression to.setFile(from.getFile()) is a void method call, and thus it cannot be parameterized
    4Type java.lang.String of variable from.getValue() does not match with type java.io.File of variable from.getFile()
    5Type java.io.File of variable from.getFile() does not match with type java.lang.String of variable from.getResource()
    6Expression to.setFile(from.getFile()) is a void method call, and thus it cannot be parameterized
    7Expression to.setResource(from.getResource()) is a void method call, and thus it cannot be parameterized
    8Type java.io.File of variable from.getFile() does not match with type java.lang.String of variable from.getResource()
    9Expression to.setResource(from.getResource()) is a void method call, and thus it cannot be parameterized
    10Expression to.setPrefix(from.getPrefix()) is a void method call, and thus it cannot be parameterized
    11Type java.lang.String of variable from.getPrefix() does not match with type org.apache.tools.ant.types.Reference of variable from.getRefid()
    12Expression to.setPrefix(from.getPrefix()) is a void method call, and thus it cannot be parameterized
    13Expression to.setRefid(from.getRefid()) is a void method call, and thus it cannot be parameterized
    14Type java.lang.String of variable from.getPrefix() does not match with type org.apache.tools.ant.types.Reference of variable from.getRefid()
    15Type org.apache.tools.ant.types.Reference of variable from.getRefid() does not match with type java.lang.String of variable from.getEnvironment()
    16Expression to.setRefid(from.getRefid()) is a void method call, and thus it cannot be parameterized
    17Expression to.setEnvironment(from.getEnvironment()) is a void method call, and thus it cannot be parameterized
    18Type org.apache.tools.ant.types.Reference of variable from.getRefid() does not match with type java.lang.String of variable from.getEnvironment()
    19Type java.lang.String of variable from.getEnvironment() does not match with type org.apache.tools.ant.types.Path of variable from.getClasspath()
    20Expression to.setEnvironment(from.getEnvironment()) is a void method call, and thus it cannot be parameterized
    21Expression to.setClasspath(from.getClasspath()) is a void method call, and thus it cannot be parameterized
    22Type java.lang.String of variable from.getEnvironment() does not match with type org.apache.tools.ant.types.Path of variable from.getClasspath()