140-1-2

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();
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();

Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/native2ascii/Native2AsciiAdapterFactory.java |  | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/taskdefs/optional/javah/JavahAdapterFactory.java
Method name: `Native2AsciiAdapter getAdapter(String, ProjectComponent)` |  | Method name: `JavahAdapter 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

                || KaffeNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) {↵

2

                || Kaffeh.IMPLEMENTATION_NAME.equals(choice)) {↵

3

                return new KaffeNative2Ascii();↵

3

                return new Kaffeh();↵

4

            } else if (SunNative2Ascii.IMPLEMENTATION_NAME.equals(choice)) {↵

4

            } else if (SunJavah.IMPLEMENTATION_NAME.equals(choice)) {↵

5

                return new SunNative2Ascii();↵

5

                return new SunJavah();↵

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 SunNative2Ascii();

11

            return new SunJavah();

See real code fragment |  | See real code fragment

Summary
Number of common nesting structure subtrees | 1
Number of refactorable cases | 0
Number of non-refactorable cases | 1
Time elapsed for finding largest common nesting structure subtrees (ms) | 1.9
Clones location | Clones are in different classes
Number of node comparisons | 28

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 4
   Number of unmapped statements in the first code fragment | 3
   Number of unmapped statements in the second code fragment | 3
   Time elapsed for statement mapping (ms) | 2.3
   Clone type | Type 2

   Mapped Statements
   ID | Statement |  | ID | Statement
   --- | --- | --- | --- | ---

   1

       if ((JavaEnvUtils.isKaffe() && choice == null) || KaffeNative2Ascii.IMPLEMENTATION_NAME.equals(choice))

   1 | if ((JavaEnvUtils.isKaffe() && choice == null) || KaffeNative2Ascii.IMPLEMENTATION_NAME.equals(choice))
   1 | if ((JavaEnvUtils.isKaffe() && choice == null) || Kaffeh.IMPLEMENTATION_NAME.equals(choice))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.apache.tools.ant.taskdefs.optional.native2ascii.KaffeNative2Ascii | org.apache.tools.ant.taskdefs.optional.javah.Kaffeh | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.apache.tools.ant.taskdefs.optional.native2ascii.KaffeNative2Ascii of variable KaffeNative2Ascii does not match with type org.apache.tools.ant.taskdefs.optional.javah.Kaffeh of variable Kaffeh
   - Make classes org.apache.tools.ant.taskdefs.optional.native2ascii.KaffeNative2Ascii and org.apache.tools.ant.taskdefs.optional.javah.Kaffeh extend a common superclass

   1

       if ((JavaEnvUtils.isKaffe() && choice == null) || Kaffeh.IMPLEMENTATION_NAME.equals(choice))

   2 | return new Kaffeh();

   Preondition Violations
   Unmatched return new Kaffeh();

   2

       return new Kaffeh();

   2

       return new KaffeNative2Ascii();

   2 | return new KaffeNative2Ascii();

   Preondition Violations
   Unmatched return new KaffeNative2Ascii();

   3

       else if (SunNative2Ascii.IMPLEMENTATION_NAME.equals(choice))

   3 | else if (SunNative2Ascii.IMPLEMENTATION_NAME.equals(choice))
   3 | else if (SunJavah.IMPLEMENTATION_NAME.equals(choice))

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii | org.apache.tools.ant.taskdefs.optional.javah.SunJavah | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii of variable SunNative2Ascii does not match with type org.apache.tools.ant.taskdefs.optional.javah.SunJavah of variable SunJavah
   - Make classes org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii and org.apache.tools.ant.taskdefs.optional.javah.SunJavah extend a common superclass

   3

       else if (SunJavah.IMPLEMENTATION_NAME.equals(choice))

   4 | return new SunJavah();

   Preondition Violations
   Unmatched return new SunJavah();

   4

       return new SunJavah();

   4

       return new SunNative2Ascii();

   4 | return new SunNative2Ascii();

   Preondition Violations
   Unmatched return new SunNative2Ascii();

   5

       else if (choice != null)

   5

       else if (choice != null)

   6

       return resolveClassName(choice);

   6

       return resolveClassName(choice);

   7 | return new SunJavah();

   Preondition Violations
   Unmatched return new SunJavah();

   7

       return new SunJavah();

   7

       return new SunNative2Ascii();

   7 | return new SunNative2Ascii();

   Preondition Violations
   Unmatched return new SunNative2Ascii();

   Precondition Violations (8)
   Row | Violation
   --- | ---
   1 | Type org.apache.tools.ant.taskdefs.optional.native2ascii.KaffeNative2Ascii of variable KaffeNative2Ascii does not match with type org.apache.tools.ant.taskdefs.optional.javah.Kaffeh of variable Kaffeh
   2 | Unmatched return new Kaffeh();
   3 | Unmatched return new KaffeNative2Ascii();
   4 | Type org.apache.tools.ant.taskdefs.optional.native2ascii.SunNative2Ascii of variable SunNative2Ascii does not match with type org.apache.tools.ant.taskdefs.optional.javah.SunJavah of variable SunJavah
   5 | Unmatched return new SunJavah();
   6 | Unmatched return new SunNative2Ascii();
   7 | Unmatched return new SunJavah();
   8 | Unmatched return new SunNative2Ascii();