[ 
https://issues.apache.org/jira/browse/CAMEL-10396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alex Dettinger updated CAMEL-10396:
-----------------------------------
    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:
{code:borderStyle=solid}
String toString(String input)
String toString(int input)
{code}
We can select both methods via bean:toString(String) or bean:toString(int)

But given those methods:
{code:borderStyle=solid}
String toString(String input)
String toString(Object input)
{code}
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.

  was:
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.


> Can't use parameter type to select among overloaded methods
> -----------------------------------------------------------
>
>                 Key: CAMEL-10396
>                 URL: https://issues.apache.org/jira/browse/CAMEL-10396
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-core
>    Affects Versions: 2.18.0
>         Environment: Ubuntu 14.04
>            Reporter: Alex Dettinger
>            Priority: Minor
>
> 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:
> {code:borderStyle=solid}
> String toString(String input)
> String toString(int input)
> {code}
> We can select both methods via bean:toString(String) or bean:toString(int)
> But given those methods:
> {code:borderStyle=solid}
> String toString(String input)
> String toString(Object input)
> {code}
> 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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to