harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Charles Lee <littlee1...@gmail.com>
Subject Re: [jira] Commented: (HARMONY-6331) [classlib][beans] remove XMLDecoderTest from the exclude list
Date Mon, 07 Sep 2009 02:39:34 GMT
Hi Nathan,
findMethod in the XMLDecoder is used for finding the invoke method in beans,
given the info from the beans xml file.
I have no idea about the logic to determine which method should be found.
(Finding the most specific method? Do not count static method?) Maybe we
need java beans spec on this.
Harmony is using Method.getMethods() to get all the methods from the beans
class. This is where drlvm and vme cause difference. drlvm will list static
method ahead of normal method, but vme list normal method first. It seems
harmony logic on findMethod is not order free, or it maybe suggest the
methods get from Method.getMethods() should be the same.
It should be fixed I think. But what is the correct logic of determine the
method to invoke on beans?

On Sat, Sep 5, 2009 at 11:57 PM, Nathan Beyer <nbeyer@gmail.com> wrote:

>
>
> On Sep 4, 2009, at 4:47 AM, Charles Lee <littlee1032@gmail.com> wrote:
>
>  On Fri, Sep 4, 2009 at 5:07 PM, Tim Ellison <t.p.ellison@gmail.com>
>> wrote:
>>
>>  On 04/Sep/2009 08:26, Charles Lee wrote:
>>>
>>>> Thanks Regis.
>>>>
>>>> The testcase will *pass* on ri and harmony+vme. But failed on
>>>>
>>> harmony+drlvm.
>>>
>>>> The reason cause this difference is due to differenct order returned by
>>>>
>>> the
>>>
>>>> Class.getMethods.
>>>> It seems findMethod in XMLDecoder shoud fix this problem, because it
>>>>
>>> should
>>>
>>>> be order free.
>>>>
>>>> Also I use "*" around the word "pass" when I mentioned result using
>>>>
>>> harmony
>>>
>>>> + vme. It is a fake pass. The exception it throw is "Cannot decide which
>>>> method to call to match get" due to the specific method order it get.
>>>> The
>>>> senario as follows:
>>>>
>>>> Class A has four method:
>>>> 1. test(int, String)
>>>> 2. test(Integer, Object)
>>>> 3. test(Object, String)
>>>> 4. test(String, Object)
>>>>
>>>> I want to invoke the test with arg null and "aaa", that is
>>>> method.invoke(null, "aaa"). Which method should be invoked?
>>>> RI: NoSuchMethodException
>>>> vme: (mothed order is 4, 1, 2, 3), "Cannot decide which method to call
>>>> to
>>>> match get", because method 4 and method 2 has the same distance.
>>>> drlvm: (mothd order is 1, 2, 3, 4), method 3 is invoked because it has
>>>>
>>> the
>>>
>>>> smallest distance.
>>>>
>>>> My question is: which method should be invoked?
>>>>
>>>
>>> Is this a quiz, or are you asking for an opinion?  I would hope that the
>>> correct answer could be determined from the Beans spec, otherwise we
>>> should follow the RI's behavior.
>>>
>>>
>> Sorry. I am asking for opinion :-)
>>
>>
>>
>>> I would guess 3, since null is a valid actual parameter for an Object
>>> formal parameter (and an int is not) and String matches exactly.
>>>
>>> I don't think the order should matter.
>>>
>>>
>> Order is mater because the logic of findMethod in XMLDecoder. As the
>> example, method 3 has the smallest distance. If the order is (4, 1, 2, 3),
>> findMethod will find 4 and 2 has the same distance then throw an
>> exception.
>> But if the order is (1, 2, 3, 4),  method 3 appears before method 4, no
>> exception thrown and findMethod find method 3. I suggest this method
>> should
>> be order free. I will fix this if I know which situation should be
>> correct.
>>
>>
>>  What does the JavaBeans spec say? It would seem odd that the order of the
> result would matter. Is the order of the result of findMethods even
> guaranteed or defined?
>
> -Nathan
>
>
>
>
>>> However, I'm not so familiar with the spec to say whether my 'logical
>>> answer' is the one the spec would give you.
>>>
>>> Regards,
>>> Tim
>>>
>>>
>>>
>>>
>>
>> --
>> Yours sincerely,
>> Charles Lee
>>
>


-- 
Yours sincerely,
Charles Lee

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message