while (keys.hasNext()) { final String key = (String) keys.next(); final Attributes attributes = (Attributes) entries.get(key); final Extension extension = getExtension("", attributes); if (null != extension) { results.add(extension); } }
while (keys.hasNext()) { final String key = (String) keys.next(); final Attributes attributes = (Attributes) entries.get(key); final Specification specification = getSpecification(key, attributes); if (null != specification) { results.add(specification); } }
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: Extension[] getAvailable(Manifest) Method name: Specification[] getSpecifications(Manifest)
Number of AST nodes: 6 Number of AST nodes: 6
1
while (keys.hasNext()) {
1
while (keys.hasNext()) {
2
            final String key = (String) keys.next();
2
            final String key = (String) keys.next();
3
            final Attributes attributes = (Attributes) entries.get(key);
3
            final Attributes attributes = (Attributes) entries.get(key);
4
            final Extension extension = getExtens
4
            final Specification specification
5
ion("", attributes);
5
                = getSpecification(key, attributes);
6
            if (null != extension) {
6
            if (null != specification) {
7
                results.add(extension);
7
                results.add(specification);
8
            }
8
            }
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.1
Clones locationClones are in different classes
Number of node comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)6.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    11
    while (keys.hasNext())
    6
    while (keys.hasNext())
    12
    final String key = (String)keys.next();
    7
    final String key = (String)keys.next();
    13
    final Attributes attributes = (Attributes)entries.get(key);
    8
    final Attributes attributes = (Attributes)entries.get(key);
                                                                                                                                                
    9
    final Specification specification = getSpecification(key, attributes);
    Preondition Violations
    Unmatched statement final Specification specification=getSpecification(key,attributes); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    9
    final Specification specification = getSpecification(key, attributes);
    14
    final Extension extension = getExtension("", attributes);
    14
    final Extension extension = getExtension("", attributes);
    Preondition Violations
    Unmatched statement final Extension extension=getExtension("",attributes); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                                                        
    15
    if (null != extension)
    15
    if (null != extension)
    10
    if (null != specification)
    Differences
    Expression1Expression2Difference
    extensionspecificationVARIABLE_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 extension does not match with type org.apache.tools.ant.taskdefs.optional.extension.Specification of variable specification
    • Make classes org.apache.tools.ant.taskdefs.optional.extension.Extension and org.apache.tools.ant.taskdefs.optional.extension.Specification extend a common superclass
    10
    if (null != specification)
    16
    results.add(extension);
    16
    results.add(extension);
    11
    results.add(specification);
    Differences
    Expression1Expression2Difference
    extensionspecificationVARIABLE_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 extension does not match with type org.apache.tools.ant.taskdefs.optional.extension.Specification of variable specification
    • Make classes org.apache.tools.ant.taskdefs.optional.extension.Extension and org.apache.tools.ant.taskdefs.optional.extension.Specification extend a common superclass
    11
    results.add(specification);
    Precondition Violations (5)
    Row Violation
    1Unmatched statement final Specification specification=getSpecification(key,attributes); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched statement final Extension extension=getExtension("",attributes); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Type org.apache.tools.ant.taskdefs.optional.extension.Extension of variable extension does not match with type org.apache.tools.ant.taskdefs.optional.extension.Specification of variable specification
    4Type org.apache.tools.ant.taskdefs.optional.extension.Extension of variable extension does not match with type org.apache.tools.ant.taskdefs.optional.extension.Specification of variable specification
    5Clone fragment #1 returns variables attributes , while Clone fragment #2 returns variables key, attributes