Spec update for Class#getDeclaredMethods()

Joseph D. Darcy Joe.Darcy at Sun.COM
Thu Jul 16 16:54:02 UTC 2009


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 expert but my guess is that there's
>>> some pretty sensitive code involved that the HotSpot team might be
>>> reluctant to go poking around in.
>>>     
>>
>> *hmpf* There's some code out there which relies on source code order
>> of members (it's not just Preon).  Hotspot appears close enough to
>> guaranteeing it that programmers make this assumption
> The solution is to not rely on reflection and to parse the bytecode 
> using by example ASM :
> see http://asm.ow2.org/
>
> Rémi
>
>

One can also impose an ordering on the program elements.  Due to a 
mis-design in the original apt API we had to write such a comparator in 
com.sun.mirror.util.SourceOrderDeclScanner:

http://hg.openjdk.java.net/jdk7/jdk7/langtools/file/7e0056ded28c/src/share/classes/com/sun/mirror/util/SourceOrderDeclScanner.java

-Joe



More information about the core-libs-dev mailing list