if (!extensionName.equals(required.getExtensionName())) { return INCOMPATIBLE; } // Available specification version must be >= required final DeweyDecimal requiredSpecificationVersion = required.getSpecificationVersion(); if (null != requiredSpecificationVersion) { if (null == specificationVersion || !isCompatible(specificationVersion, requiredSpecificationVersion)) { return REQUIRE_SPECIFICATION_UPGRADE; } } // Implementation Vendor ID must match final String requiredImplementationVendorID = required.getImplementationVendorID(); if (null != requiredImplementationVendorID) { if (null == implementationVendorID || !implementationVendorID.equals(requiredImplementationVendorID)) { return REQUIRE_VENDOR_SWITCH; } } // Implementation version must be >= required final DeweyDecimal requiredImplementationVersion = required.getImplementationVersion(); if (null != requiredImplementationVersion) { if (null == implementationVersion || !isCompatible(implementationVersion, requiredImplementationVersion)) { return REQUIRE_IMPLEMENTATION_UPGRADE; } } // This available optional package satisfies the requirements return COMPATIBLE;
if (!specificationTitle.equals(other.getSpecificationTitle())) { return INCOMPATIBLE; } // Available specification version must be >= required final DeweyDecimal otherSpecificationVersion = other.getSpecificationVersion(); if (null != specificationVersion) { if (null == otherSpecificationVersion || !isCompatible(specificationVersion, otherSpecificationVersion)) { return REQUIRE_SPECIFICATION_UPGRADE; } } // Implementation Vendor ID must match final String otherImplementationVendor = other.getImplementationVendor(); if (null != implementationVendor) { if (null == otherImplementationVendor || !implementationVendor.equals(otherImplementationVendor)) { return REQUIRE_VENDOR_SWITCH; } } // Implementation version must be >= required final String otherImplementationVersion = other.getImplementationVersion(); if (null != implementationVersion) { if (null == otherImplementationVersion || !implementationVersion.equals(otherImplementationVersion)) { return REQUIRE_IMPLEMENTATION_CHANGE; } } // This available optional package satisfies the requirements return COMPATIBLE;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/extension/Extension.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/extension/Specification.java
Method name: Compatibility getCompatibilityWith(Extension) Method name: Compatibility getCompatibilityWith(Specification)
Number of AST nodes: 15 Number of AST nodes: 15
1
if (!extensionName.equals(required.getExtensionName())) {
1
if (!specificationTitle.equals(other.getSpecificationTitle())) {
2
            return INCOMPATIBLE;
2
            return INCOMPATIBLE;
3
        }
3
        }
4
        // Available specification version must be >= required
4
        // Available specification version must be >= required
5
        final DeweyDecimal requiredSpecificationVersion
5
        final DeweyDecimal otherSpecificationVersion
6
            = required.getSpecificationVersion();
6
            = other.getSpecificationVersion();
7
        if (null != requiredSpecificationVersion) {
7
        if (null != specificationVersion) {
8
            if (null == specificationVersion
8
            if (null == otherSpecificationVersion
9
                || !isCompatible(specificationVersion, requiredSpecificationVersion)) {
9
                || !isCompatible(specificationVersion, otherSpecificationVersion)) {
10
                return REQUIRE_SPECIFICATION_UPGRADE;
10
                return REQUIRE_SPECIFICATION_UPGRADE;
11
            }
11
            }
12
        }
12
        }
13
        // Implementation Vendor ID must match
13
        // Implementation Vendor ID must match
14
        final String requiredImplementationVendorID
14
        final String otherImplementationVendor
15
            = required.getImplementationVendorID();
15
            = other.getImplementationVendor();
16
        if (null != requiredImplementationVendorID) {
16
        if (null != implementationVendor) {
17
            if (null == implementationVendorID
17
            if (null == otherImplementationVendor
18
                || !implementationVendorID.equals(requiredImplementationVendorID)) {
18
                || !implementationVendor.equals(otherImplementationVendor)) {
19
                return REQUIRE_VENDOR_SWITCH;
19
                return REQUIRE_VENDOR_SWITCH;
20
            }
20
            }
21
        }
21
        }
22
        // Implementation version must be >= required
22
        // Implementation version must be >= required
23
        final DeweyDecimal requiredImplementationVersion
23
        final String otherImplementationVersion
24
            = required.getImplementationVersion();
24
            = other.getImplementationVersion();
25
        if (null != requiredImplementationVersion) {
25
        if (null != implementationVersion) {
26
            if (null == implementationVersion
26
            if (null == otherImplementationVersion
27
                || !isCompatible(implementationVersion, requiredImplementationVersion)) {
27
                || !implementationVersion.equals(otherImplementationVersion)) {
28
                return REQUIRE_IMPLEMENTATION_UPGRADE;
28
                return REQUIRE_IMPLEMENTATION_CHANGE;
29
            }
29
            }
30
        }
30
        }
31
        // This available optional package satisfies the requirements
31
        // This available optional package satisfies the requirements
32
        return COMPATIBLE;
32
        return COMPATIBLE;
Summary
Number of common nesting structure subtrees2
Number of refactorable cases0
Number of non-refactorable cases2
Time elapsed for finding largest common nesting structure subtrees (ms)4.2
Clones locationClones are in different classes
Number of node comparisons47
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)3.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    3
    final DeweyDecimal requiredSpecificationVersion = required.getSpecificationVersion();
    3
    final DeweyDecimal requiredSpecificationVersion = required.getSpecificationVersion();
    3
    final DeweyDecimal otherSpecificationVersion = other.getSpecificationVersion();
    Differences
    Expression1Expression2Difference
    requiredSpecificationVersionotherSpecificationVersionVARIABLE_NAME_MISMATCH
    requiredotherVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.optional.extension.Extensionorg.apache.tools.ant.taskdefs.optional.extension.SpecificationVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.optional.extension.Extension of variable required does not match with type org.apache.tools.ant.taskdefs.optional.extension.Specification of variable other
    • Make classes org.apache.tools.ant.taskdefs.optional.extension.Extension and org.apache.tools.ant.taskdefs.optional.extension.Specification extend a common superclass
    3
    final DeweyDecimal otherSpecificationVersion = other.getSpecificationVersion();
    4
    if (null != requiredSpecificationVersion)
    4
    if (null != requiredSpecificationVersion)
    4
    if (null != specificationVersion)
    Differences
    Expression1Expression2Difference
    requiredSpecificationVersionspecificationVersionVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression requiredSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    if (null != specificationVersion)
    5
    if (null == specificationVersion || !isCompatible(specificationVersion, requiredSpecificationVersion))
    5
    if (null == specificationVersion || !isCompatible(specificationVersion, requiredSpecificationVersion))
    5
    if (null == otherSpecificationVersion || !isCompatible(specificationVersion, otherSpecificationVersion))
    Differences
    Expression1Expression2Difference
    specificationVersionotherSpecificationVersionVARIABLE_NAME_MISMATCH
    requiredSpecificationVersionotherSpecificationVersionVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression otherSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression requiredSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression otherSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    if (null == otherSpecificationVersion || !isCompatible(specificationVersion, otherSpecificationVersion))
    6
    return REQUIRE_SPECIFICATION_UPGRADE;
    6
    return REQUIRE_SPECIFICATION_UPGRADE;
                                                                                                                                                        
    7
    final String otherImplementationVendor = other.getImplementationVendor();
    7
    final String requiredImplementationVendorID = required.getImplementationVendorID();
                                                                                                                                                                            
    8
    if (null != requiredImplementationVendorID)
    8
    if (null != requiredImplementationVendorID)
    8
    if (null != implementationVendor)
    Differences
    Expression1Expression2Difference
    requiredImplementationVendorIDimplementationVendorVARIABLE_NAME_MISMATCH
    8
    if (null != implementationVendor)
    9
    if (null == implementationVendorID || !implementationVendorID.equals(requiredImplementationVendorID))
    9
    if (null == implementationVendorID || !implementationVendorID.equals(requiredImplementationVendorID))
    9
    if (null == otherImplementationVendor || !implementationVendor.equals(otherImplementationVendor))
    Differences
    Expression1Expression2Difference
    implementationVendorIDotherImplementationVendorVARIABLE_NAME_MISMATCH
    requiredImplementationVendorIDotherImplementationVendorVARIABLE_NAME_MISMATCH
    implementationVendorIDimplementationVendorVARIABLE_NAME_MISMATCH
    9
    if (null == otherImplementationVendor || !implementationVendor.equals(otherImplementationVendor))
    10
    return REQUIRE_VENDOR_SWITCH;
    10
    return REQUIRE_VENDOR_SWITCH;
    Precondition Violations (5)
    Row Violation
    1Type org.apache.tools.ant.taskdefs.optional.extension.Extension of variable required does not match with type org.apache.tools.ant.taskdefs.optional.extension.Specification of variable other
    2Expression requiredSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression otherSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression requiredSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression otherSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
  2. {Non-refactorable}
    Mapping Summary
    Number of mapped statements7
    Number of unmapped statements in the first code fragment5
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)2.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    3
    final DeweyDecimal requiredSpecificationVersion = required.getSpecificationVersion();
    3
    final DeweyDecimal requiredSpecificationVersion = required.getSpecificationVersion();
    3
    final DeweyDecimal otherSpecificationVersion = other.getSpecificationVersion();
    Differences
    Expression1Expression2Difference
    requiredSpecificationVersionotherSpecificationVersionVARIABLE_NAME_MISMATCH
    requiredotherVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.optional.extension.Extensionorg.apache.tools.ant.taskdefs.optional.extension.SpecificationVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.optional.extension.Extension of variable required does not match with type org.apache.tools.ant.taskdefs.optional.extension.Specification of variable other
    • Make classes org.apache.tools.ant.taskdefs.optional.extension.Extension and org.apache.tools.ant.taskdefs.optional.extension.Specification extend a common superclass
    3
    final DeweyDecimal otherSpecificationVersion = other.getSpecificationVersion();
    4
    if (null != requiredSpecificationVersion)
                                                                                          
    5
    if (null == specificationVersion || !isCompatible(specificationVersion, requiredSpecificationVersion))
                                                                                                                                                                                                                  
    6
    return REQUIRE_SPECIFICATION_UPGRADE;
    6
    return REQUIRE_SPECIFICATION_UPGRADE;
    Preondition Violations
    Unmatched return REQUIRE_SPECIFICATION_UPGRADE;
                                                                                    
                                                                                                                                                        
    7
    final String otherImplementationVendor = other.getImplementationVendor();
    7
    final String requiredImplementationVendorID = required.getImplementationVendorID();
                                                                                                                                                                            
    8
    if (null != requiredImplementationVendorID)
    8
    if (null != requiredImplementationVendorID)
    8
    if (null != implementationVendor)
    Differences
    Expression1Expression2Difference
    requiredImplementationVendorIDimplementationVendorVARIABLE_NAME_MISMATCH
    8
    if (null != implementationVendor)
    9
    if (null == implementationVendorID || !implementationVendorID.equals(requiredImplementationVendorID))
    9
    if (null == implementationVendorID || !implementationVendorID.equals(requiredImplementationVendorID))
    9
    if (null == otherImplementationVendor || !implementationVendor.equals(otherImplementationVendor))
    Differences
    Expression1Expression2Difference
    implementationVendorIDotherImplementationVendorVARIABLE_NAME_MISMATCH
    requiredImplementationVendorIDotherImplementationVendorVARIABLE_NAME_MISMATCH
    implementationVendorIDimplementationVendorVARIABLE_NAME_MISMATCH
    9
    if (null == otherImplementationVendor || !implementationVendor.equals(otherImplementationVendor))
    10
    return REQUIRE_VENDOR_SWITCH;
    10
    return REQUIRE_VENDOR_SWITCH;
    11
    final DeweyDecimal requiredImplementationVersion = required.getImplementationVersion();
                                                                                                                                                                                      
    12
    if (null != requiredImplementationVersion)
    12
    if (null != requiredImplementationVersion)
    4
    if (null != specificationVersion)
    Differences
    Expression1Expression2Difference
    requiredImplementationVersionspecificationVersionVARIABLE_NAME_MISMATCH
    4
    if (null != specificationVersion)
    13
    if (null == implementationVersion || !isCompatible(implementationVersion, requiredImplementationVersion))
    13
    if (null == implementationVersion || !isCompatible(implementationVersion, requiredImplementationVersion))
    5
    if (null == otherSpecificationVersion || !isCompatible(specificationVersion, otherSpecificationVersion))
    Differences
    Expression1Expression2Difference
    implementationVersionotherSpecificationVersionVARIABLE_NAME_MISMATCH
    implementationVersionspecificationVersionVARIABLE_NAME_MISMATCH
    requiredImplementationVersionotherSpecificationVersionVARIABLE_NAME_MISMATCH
    Preondition Violations
    Expression otherSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression otherSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    if (null == otherSpecificationVersion || !isCompatible(specificationVersion, otherSpecificationVersion))
    14
    return REQUIRE_IMPLEMENTATION_UPGRADE;
    14
    return REQUIRE_IMPLEMENTATION_UPGRADE;
    6
    return REQUIRE_SPECIFICATION_UPGRADE;
    Differences
    Expression1Expression2Difference
    REQUIRE_IMPLEMENTATION_UPGRADEREQUIRE_SPECIFICATION_UPGRADEVARIABLE_NAME_MISMATCH
    6
    return REQUIRE_SPECIFICATION_UPGRADE;
    Precondition Violations (5)
    Row Violation
    1Type org.apache.tools.ant.taskdefs.optional.extension.Extension of variable required does not match with type org.apache.tools.ant.taskdefs.optional.extension.Specification of variable other
    2Unmatched return REQUIRE_SPECIFICATION_UPGRADE;
    3Expression otherSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression otherSpecificationVersion cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Clone fragment #1 returns variables requiredSpecificationVersion , while Clone fragment #2 returns variables