On 12/1/2015 7:47 AM, Stephane Epardaud wrote:
I'm using reflection to walk classes and methods, and walking
java.lang.Object.hashCode() I get an annotation of type
jdk.internal.HotSpotIntrinsicCandidate, which does not appear to be
exported by java.base (it exports jdk but not jdk.internal). Is that
intentional? I would have thought that since the annotation is on an
exported type, javac would not allow it to be annotated with
non-exported annotations…

There shouldn't be any surprise here. In Java SE 8, you can declare a package-private annotation type and use it to write annotations on public classes of that package. Going up a level in Java SE 9, you can declare a module-private annotation type (i.e. public @interface Foo in a non-exported package) and use it to write annotations on exported public classes of that module.

Alex

Reply via email to