Re: Spec update for Class#getDeclaredMethods()

2009-07-16 Thread Joseph D. Darcy
Rémi Forax wrote: Florian Weimer a écrit : * Eamonn McManus: The proposed change could be made, but it is not just a spec change. All JVMs that don't currently conform to the spec would need to change, as Rémi Forax notes, and that includes the JDK and its derivatives. I'm not a HotSpot expe

Re: Spec update for Class#getDeclaredMethods()

2009-07-16 Thread Joseph D. Darcy
Florian Weimer wrote: * Rémi Forax: The solution is to not rely on reflection and to parse the bytecode using by example ASM : see http://asm.ow2.org/ I think you'd still need to sort based on line numbers, which requires debugging information which is not always available. The only

Re: Spec update for Class#getDeclaredMethods()

2009-07-16 Thread Florian Weimer
* Rémi Forax: > The solution is to not rely on reflection and to parse the bytecode > using by example ASM : > see http://asm.ow2.org/ I think you'd still need to sort based on line numbers, which requires debugging information which is not always available. The only reliable way I know is to us

Re: Spec update for Class#getDeclaredMethods()

2009-07-16 Thread Dalibor Topic
Rémi Forax wrote: > Florian Weimer a écrit : >> I suggest to replace: >> >> | The elements [methods] in the array returned are not sorted and are >> | not in any particular order. >> >> with: >> >> | If the class is a compiled Java class, the elements in the array are >> | sorted according to the o

Re: Spec update for Class#getDeclaredMethods()

2009-07-16 Thread Rémi Forax
Florian Weimer a écrit : * Eamonn McManus: The proposed change could be made, but it is not just a spec change. All JVMs that don't currently conform to the spec would need to change, as Rémi Forax notes, and that includes the JDK and its derivatives. I'm not a HotSpot expert but my guess is

Re: Spec update for Class#getDeclaredMethods()

2009-07-16 Thread Florian Weimer
* Eamonn McManus: > The proposed change could be made, but it is not just a spec > change. All JVMs that don't currently conform to the spec would need > to change, as Rémi Forax notes, and that includes the JDK and its > derivatives. I'm not a HotSpot expert but my guess is that there's > some pr

Re: Spec update for Class#getDeclaredMethods()

2009-07-16 Thread Eamonn McManus
Code that relies on Class.getDeclaredMethods() returning the methods in source-code order is currently wrong not just in theory but in practice. That the JDK appears to return them in that order is a fragile coincidence, as I explained in this blog entry. Apparently unrelated changes anywhere e

Re: Spec update for Class#getDeclaredMethods()

2009-07-16 Thread Rémi Forax
Florian Weimer a écrit : I suggest to replace: | The elements [methods] in the array returned are not sorted and are | not in any particular order. with: | If the class is a compiled Java class, the elements in the array are | sorted according to the order of declaration in the source code. |