[rfc][icedtea-web] LiveConnect Method Overload Resolver Fix

Adam Domurad domuradical at gmail.com
Mon Jun 23 14:49:56 UTC 2014


On Mon, Jun 23, 2014 at 10:44 AM, Jiri Vanek <jvanek at redhat.com> wrote:
> CC Adam as original author. Also he accidentaly proved he is still "Alive
> out there" So W ecanhope to catch him :)

Well, original refactorer :-)

> On 06/20/2014 04:22 PM, Jie Kang wrote:
>>
>> Hello,
>>
>> When refactoring the LiveConnect tests I discovered a bug in the
>> MethodOverloadResolver implementation where choosing the correct superclass
>> did not take into account the hierarchy distance. This was causing
>> JSToJFuncResolTest - AppletJSToJFuncResol_inheritedClassToParent1_Test to
>> fail intermittently.
>>
>> E.g.
>>
>> A extends B extends C : Object of Type C is passed as argument to function
>> that accepts either Type A or Type B objects. As per LiveConnect and Java
>> specification, the correct resolution of this is to use the function that
>> accepts Type B. However, the implementation of MethodOverloadResolver did
>> not comply with this and nearly always used the Type A function (both Type A
>> and Type B functions were scored equally and the choice of use depended on
>> the order of comparison, which is not always the same).
>>
>> The patch resolves this issue by following LiveConnect specification
>> located here:
>> https://jdk6.java.net/plugin2/liveconnect/#OVERLOADED_METHODS
>> where a distance calculation for class hierarchy is used to resolve the
>> issue. It also removes the Known to Fail annotation for the test case which
>> should no longer fail.

I just skimmed it, but it looks good to me. Only small nit is that
lowestDistance is not always strictly true since lowestCost is the
first criteria.

Thanks for the fix,
-Adam

>>
>>
>> Regards,
>>
>> --
>> Jie Kang
>>
>


More information about the distro-pkg-dev mailing list