146-1-2

methodName = s.trim(); Method executeM = null; executeM = dispatchable.getClass().getMethod( methodName, new Class[0]); if (executeM == null) { throw new BuildException( "No public " + methodName + "() in " + dispatchable.getClass()); } executeM.invoke(dispatchable, (Object[]) null); if (task instanceof UnknownElement) { ((UnknownElement) task).setRealThing(null); }
Method executeM = null; executeM = task.getClass().getMethod(methodName, new Class[0]); if (executeM == null) { throw new BuildException("No public " + methodName + "() in " + task.getClass()); } executeM.invoke(task, (Object[]) null); if (task instanceof UnknownElement) { ((UnknownElement) task).setRealThing(null); }

Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/dispatch/DispatchUtils.java |  | File path: /apache-ant-1.7.0/src/org/apache/tools/ant/dispatch/DispatchUtils.java
Method name: `void execute(Object)` |  | Method name: `void execute(Object)`
Number of AST nodes: 8 |  | Number of AST nodes: 7

1

    methodName = s.trim();↵

2

                                        Method executeM = null;↵

1

    Method executeM = null;↵

3

                                        executeM = dispatchable.getClass().getMethod(↵

2

                    executeM = task.getClass().getMethod(↵

4

                                            methodName, new Class[0]);↵

3

    methodName, new Class[0]);↵

5

                                        if (executeM == null) {↵

4

                    if (executeM == null) {↵

6

                                            throw new BuildException(↵

5

                        throw new BuildException(↵

7

                                                "No public " + methodName + "() in "↵

6

    "No public " + methodName + "() in "↵

8

                                                + dispatchable.getClass());↵

7

                            + task.getClass());↵

9

                                        }↵

8

                    ↵

10

                        ↵

9

    }↵

11

                    executeM.invoke(dispatchable, (Object[]) null);↵

10

                    executeM.invoke(task, (Object[]) null);↵

12

                                        if (task instanceof UnknownElement) {↵

11

                    if (task instanceof UnknownElement) {↵

13

                                            ((UnknownElement) task).setRealThing(null);↵

12

                        ((UnknownElement) task).setRealThing(null);↵

14

                                        }

13

                    }

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) | 0.2
Clones location | Clones are in the same method
Number of node comparisons | 19

1. {Non-refactorable}

   Mapping Summary
   Number of mapped statements | 7
   Number of unmapped statements in the first code fragment | 1
   Number of unmapped statements in the second code fragment | 0
   Time elapsed for statement mapping (ms) | 2.2
   Clone type | Type 3

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

   26

       methodName = s.trim();

   27

       Method executeM = null;

   37

       Method executeM = null;

   28

       executeM = dispatchable.getClass().getMethod(methodName, new Class[0]);

   28 | executeM = dispatchable.getClass().getMethod(methodName, new Class[0]);
   38 | executeM = task.getClass().getMethod(methodName, new Class[0]);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   java.lang.Class | java.lang.Class | VARIABLE_TYPE_MISMATCH
   dispatchable | task | VARIABLE_NAME_MISMATCH
   org.apache.tools.ant.dispatch.Dispatchable | java.lang.Object | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.lang.Class<> of variable dispatchable.getClass() does not match with type java.lang.Class<> of variable task.getClass()
   - Make classes java.lang.Class and java.lang.Class extend a common superclass

   Type org.apache.tools.ant.dispatch.Dispatchable of variable dispatchable does not match with type java.lang.Object of variable task
   - Make classes org.apache.tools.ant.dispatch.Dispatchable and java.lang.Object extend a common superclass

   38

       executeM = task.getClass().getMethod(methodName, new Class[0]);

   29

       if (executeM == null)

   39

       if (executeM == null)

   30

       throw new BuildException("No public " + methodName + "() in " + dispatchable.getClass());

   30 | throw new BuildException("No public " + methodName + "() in " + dispatchable.getClass());
   40 | throw new BuildException("No public " + methodName + "() in " + task.getClass());

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   java.lang.Class | java.lang.Class | VARIABLE_TYPE_MISMATCH
   dispatchable | task | VARIABLE_NAME_MISMATCH
   org.apache.tools.ant.dispatch.Dispatchable | java.lang.Object | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type java.lang.Class<> of variable dispatchable.getClass() does not match with type java.lang.Class<> of variable task.getClass()
   - Make classes java.lang.Class and java.lang.Class extend a common superclass

   Type org.apache.tools.ant.dispatch.Dispatchable of variable dispatchable does not match with type java.lang.Object of variable task
   - Make classes org.apache.tools.ant.dispatch.Dispatchable and java.lang.Object extend a common superclass

   40

       throw new BuildException("No public " + methodName + "() in " + task.getClass());

   31

       executeM.invoke(dispatchable, (Object[])null);

   31 | executeM.invoke(dispatchable, (Object[])null);
   41 | executeM.invoke(task, (Object[])null);

   Differences
   Expression1 | Expression2 | Difference
   --- | --- | ---
   dispatchable | task | VARIABLE_NAME_MISMATCH
   org.apache.tools.ant.dispatch.Dispatchable | java.lang.Object | VARIABLE_TYPE_MISMATCH

   Preondition Violations

   Type org.apache.tools.ant.dispatch.Dispatchable of variable dispatchable does not match with type java.lang.Object of variable task
   - Make classes org.apache.tools.ant.dispatch.Dispatchable and java.lang.Object extend a common superclass

   41

       executeM.invoke(task, (Object[])null);

   32

       if (task instanceof UnknownElement)

   42

       if (task instanceof UnknownElement)

   33

       ((UnknownElement)task).setRealThing(null);

   43

       ((UnknownElement)task).setRealThing(null);

   Precondition Violations (5)
   Row | Violation
   --- | ---
   1 | Type java.lang.Class<> of variable dispatchable.getClass() does not match with type java.lang.Class<> of variable task.getClass()
   2 | Type org.apache.tools.ant.dispatch.Dispatchable of variable dispatchable does not match with type java.lang.Object of variable task
   3 | Type java.lang.Class<> of variable dispatchable.getClass() does not match with type java.lang.Class<> of variable task.getClass()
   4 | Type org.apache.tools.ant.dispatch.Dispatchable of variable dispatchable does not match with type java.lang.Object of variable task
   5 | Type org.apache.tools.ant.dispatch.Dispatchable of variable dispatchable does not match with type java.lang.Object of variable task