if ((JavaEnvUtils.isKaffe() && choice == null) || Kaffeh.IMPLEMENTATION_NAME.equals(choice)) { return new Kaffeh(); } else if (SunJavah.IMPLEMENTATION_NAME.equals(choice)) { return new SunJavah(); } else if (choice != null) { return resolveClassName(choice); } // This default has been good enough until Ant 1.6.3, so stick // with it return new SunJavah();
if ((JavaEnvUtils.isKaffe() && choice == null) || KaffeNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) { return new KaffeNative2Ascii(); } else if (SunNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) { return new SunNative2Ascii(); } else if (choice != null) { return resolveClassName(choice); } // This default has been good enough until Ant 1.6.3, so stick // with it return new SunNative2Ascii();
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/native2ascii/Native2AsciiAdapterFactory.java
Method name: JavahAdapter getAdapter(String, ProjectComponent) Method name: Native2AsciiAdapter getAdapter(String, ProjectComponent)
Number of AST nodes: 7 Number of AST nodes: 7
1
if ((JavaEnvUtils.isKaffe() && choice == null)
1
if ((JavaEnvUtils.isKaffe() && choice == null)
2
            || Kaffeh.IMPLEMENTATION_NAME.equals(choice)) {
2
            || KaffeNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) {
3
            return new Kaffeh();
3
            return new KaffeNative2Ascii();
4
        } else if (SunJavah.IMPLEMENTATION_NAME.equals(choice)) {
4
        } else if (SunNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) {
5
            return new SunJavah();
5
            return new SunNative2Ascii();
6
        } else if (choice != null) {
6
        } else if (choice != null) {
7
            return resolveClassName(choice);
7
            return resolveClassName(choice);
8
        }
8
        }
9
        // This default has been good enough until Ant 1.6.3, so stick
9
        // This default has been good enough until Ant 1.6.3, so stick
10
        // with it
10
        // with it
11
        return new SunJavah();
11
        return new SunNative2Ascii();
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.7
Clones locationClones are in different classes
Number of node comparisons28
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if ((JavaEnvUtils.isKaffe() && choice == null) || Kaffeh.IMPLEMENTATION_NAME.equals(choice))
    1
    if ((JavaEnvUtils.isKaffe() && choice == null) || Kaffeh.IMPLEMENTATION_NAME.equals(choice))
    1
    if ((JavaEnvUtils.isKaffe() && choice == null) || KaffeNative2Ascii.IMPLEMENTATION_NAME.equals(choice))
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.optional.javah.Kaffehorg.apache.tools.ant.taskdefs.optional.native2ascii.KaffeNative2AsciiVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.optional.javah.Kaffeh of variable Kaffeh does not match with type org.apache.tools.ant.taskdefs.optional.native2ascii.KaffeNative2Ascii of variable KaffeNative2Ascii
    • Make classes org.apache.tools.ant.taskdefs.optional.javah.Kaffeh and org.apache.tools.ant.taskdefs.optional.native2ascii.KaffeNative2Ascii extend a common superclass
    1
    if ((JavaEnvUtils.isKaffe() && choice == null) || KaffeNative2Ascii.IMPLEMENTATION_NAME.equals(choice))
                                                                        
    2
    return new KaffeNative2Ascii();
    Preondition Violations
    Unmatched return new KaffeNative2Ascii();
    2
    return new KaffeNative2Ascii();
    2
    return new Kaffeh();
    2
    return new Kaffeh();
    Preondition Violations
    Unmatched return new Kaffeh();
                                                  
    3
    else if (SunJavah.IMPLEMENTATION_NAME.equals(choice))
    3
    else if (SunJavah.IMPLEMENTATION_NAME.equals(choice))
    3
    else if (SunNative2Ascii.IMPLEMENTATION_NAME.equals(choice))
    Differences
    Expression1Expression2Difference
    org.apache.tools.ant.taskdefs.optional.javah.SunJavahorg.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2AsciiVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.apache.tools.ant.taskdefs.optional.javah.SunJavah of variable SunJavah does not match with type org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii of variable SunNative2Ascii
    • Make classes org.apache.tools.ant.taskdefs.optional.javah.SunJavah and org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii extend a common superclass
    3
    else if (SunNative2Ascii.IMPLEMENTATION_NAME.equals(choice))
                                                                    
    4
    return new SunNative2Ascii();
    Preondition Violations
    Unmatched return new SunNative2Ascii();
    4
    return new SunNative2Ascii();
    4
    return new SunJavah();
    4
    return new SunJavah();
    Preondition Violations
    Unmatched return new SunJavah();
                                                      
    5
    else if (choice != null)
    5
    else if (choice != null)
    6
    return resolveClassName(choice);
    6
    return resolveClassName(choice);
                                                                    
    7
    return new SunNative2Ascii();
    Preondition Violations
    Unmatched return new SunNative2Ascii();
    7
    return new SunNative2Ascii();
    7
    return new SunJavah();
    7
    return new SunJavah();
    Preondition Violations
    Unmatched return new SunJavah();
                                                      
    Precondition Violations (8)
    Row Violation
    1Type org.apache.tools.ant.taskdefs.optional.javah.Kaffeh of variable Kaffeh does not match with type org.apache.tools.ant.taskdefs.optional.native2ascii.KaffeNative2Ascii of variable KaffeNative2Ascii
    2Unmatched return new KaffeNative2Ascii();
    3Unmatched return new Kaffeh();
    4Type org.apache.tools.ant.taskdefs.optional.javah.SunJavah of variable SunJavah does not match with type org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii of variable SunNative2Ascii
    5Unmatched return new SunNative2Ascii();
    6Unmatched return new SunJavah();
    7Unmatched return new SunNative2Ascii();
    8Unmatched return new SunJavah();