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); } }
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); } }
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/extension/Specification.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/extension/Extension.java
Method name: Specification[] getSpecifications(Manifest) Method name: Extension[] getAvailable(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 Specification specification
4
            final 
5
                = getSpecification(key, attributes);
5
Extension extension = getExtension("", attributes);
6
            if (null != specification) {
6
            if (null != extension) {
7
                results.add(specification);
7
                results.add(extension);
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.2
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.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    while (keys.hasNext())
    11
    while (keys.hasNext())
    7
    final String key = (String)keys.next();
    12
    final String key = (String)keys.next();
    8
    final Attributes attributes = (Attributes)entries.get(key);
    13
    final Attributes attributes = (Attributes)entries.get(key);
    9
    final Specification specification = getSpecification(key, attributes);
    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
                                                                                                                                                
                                                                                                                        
    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
    14
    final Extension extension = getExtension("", attributes);
    10
    if (null != specification)
    10
    if (null != specification)
    15
    if (null != extension)
    Differences
    Expression1Expression2Difference
    specificationextensionVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.optional.extension.Specificationorg.apache.tools.ant.taskdefs.optional.extension.ExtensionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.optional.extension.Specification of variable specification does not match with type org.apache.tools.ant.taskdefs.optional.extension.Extension of variable extension
    • Make classes org.apache.tools.ant.taskdefs.optional.extension.Specification and org.apache.tools.ant.taskdefs.optional.extension.Extension extend a common superclass
    15
    if (null != extension)
    11
    results.add(specification);
    11
    results.add(specification);
    16
    results.add(extension);
    Differences
    Expression1Expression2Difference
    specificationextensionVARIABLE_NAME_MISMATCH
    org.apache.tools.ant.taskdefs.optional.extension.Specificationorg.apache.tools.ant.taskdefs.optional.extension.ExtensionVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.optional.extension.Specification of variable specification does not match with type org.apache.tools.ant.taskdefs.optional.extension.Extension of variable extension
    • Make classes org.apache.tools.ant.taskdefs.optional.extension.Specification and org.apache.tools.ant.taskdefs.optional.extension.Extension extend a common superclass
    16
    results.add(extension);
    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.Specification of variable specification does not match with type org.apache.tools.ant.taskdefs.optional.extension.Extension of variable extension
    4Type org.apache.tools.ant.taskdefs.optional.extension.Specification of variable specification does not match with type org.apache.tools.ant.taskdefs.optional.extension.Extension of variable extension
    5Clone fragment #1 returns variables key, attributes , while Clone fragment #2 returns variables attributes