Uploaded image for project: 'Camel'
  1. Camel
  2. CAMEL-10396

Can't use parameter type to select among overloaded methods

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.18.0
    • Fix Version/s: 2.19.0
    • Component/s: camel-core
    • Labels:
      None
    • Environment:

      Ubuntu 14.04

    • Estimated Complexity:
      Unknown

      Description

      I've noticed that the overload selection mechanism based on parameter types is not working when some parameters are assignable, in the sense of Class.isAssignableFrom(...).

      Given those methods:

      String toString(String input)
      String toString(int input)
      

      We can select both methods via bean:toString(String) or bean:toString(int)

      But given those methods:

      String toString(String input)
      String toString(Object input)
      

      bean:toString(String) end in selecting toString(Object).

      Ideally, I would expect it to select toString(String). Otherwise, unwinding an AmbiguousCallException may perhaps apply.

      Thoughts:
      I'm wondering whether ObjectHelper.isOverridingMethod(...) would be mixing overload vs override.

      Will attach a test case.

        Attachments

        1. MethodOverloadCamelTest.java
          1 kB
          Alex Dettinger

          Issue Links

            Activity

              People

              • Assignee:
                davsclaus Claus Ibsen
                Reporter:
                aldettinger Alex Dettinger
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: