On Sep 16, 2008, at 12:41 PM, Rémi Forax wrote: > Attila Szegedi a écrit : >> On Sep 16, 2008, at 3:15 AM, Rich Hickey wrote: >> >> >>> How is everyone handling the filtering of synthetic/bridge methods? >>> >>> Using the reflection API, I'm seeing differences between JDK 1.5 and >>> 6, with methods like StringBuilder.length marked as bridge/synthetic >>> in JDK 6 (!?) >>> >>> Is there a reliable way to deduce the 'real' method set via >>> reflection? >>> >>> Here are the signatures and (hex) modifiers for StringBuilder, via >>> getMethods(): >>> >>> http://clojure.googlegroups.com/web/jdk5.txt >>> http://clojure.googlegroups.com/web/jdk6.txt >>> >>> In JDK 1.5, filtering on isBridge works ok. But this will filter out >>> StringBuilder.length and others on JDK 6. >>> >> >> Most interesting, especially considering that bridge methods are >> really only ever needed for parametric types, and there's not a >> single >> type parameter in StringBuilder... >> > Don't forget covariant return type :)
Right. Neither explains why are length() and setLength() marked with 1041 in Java 6 though... FWIW, I'm quite wary of the overloads that only differ in return type... Quite recently a bug has come up in my reflection handling code in FreeMarker regarding covariant bridge methods popping up in java.beans.PropertyDescriptor instances, see <http://thread.gmane.org/gmane.comp.web.freemarker.devel/6935 >. Basically, the Beans introspector created property descriptors pairing in them a non-bridge setter and a bridge getter... I also started some follow up discussion on ADVANCED-JAVA list at <http://discuss.develop.com/archives/wa.exe?A2=ind0808&L=advanced-java&T=0&F=&S=&P=47 > centering on the issue of how do multiple methods that only differ in return type not screw up the overloaded method resolution algorithm in JLS 15.2.2... and I didn't get a satisfying answer there. Attila. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to jvm-languages@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---