Regression in JDK8 build 78: javac complains about missing Class#isAnnotationPresent (original) (raw)

David M. Lloyd david.lloyd at redhat.com
Thu Feb 28 18:05:40 PST 2013


On 02/28/2013 07:25 PM, Joe Darcy wrote:

As for the technical details of what is going on, the isAnnotationPresent method in the java.lang.reflect.AnnotatedElement interface has been turned into a default method:

http://bugs.sun.com/viewbug.do?bugid=8007113 This change was introduced in b77 and allows some sharing of code among the various classes implementing AnnotatedElement, including java.lang.Class, java.lang.reflect.{Method, Constructor}. For reasons I'll describe shortly, when compiling under a -source setting earlier than source 8, code that references isAnnotationPresent in the implementing classes (or the declaring interface) will not see the method as being present. Code that does not reference this method will continue to compile under "-source OLD -target OLD" (with the usual caveats) and code that references this method will see the method as expected under -source 8.

Is this something which only occurs at compile time, or will runtime code which does invokevirtual on Class#isAnnotationPresent() blow up with the same sort of exception? If so then the method ought to be retained on this class, with an upcall to the default implementation.

Do we have any sort of document which covers runtime (binary) compatibility considerations for 8 in general, or the new lambda functionality in particular?

--



More information about the compiler-dev mailing list