Question about jdk.internal.HotSpotIntrinsicCandidate

Alex Buckley alex.buckley at oracle.com
Tue Dec 1 21:04:57 UTC 2015


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


More information about the jigsaw-dev mailing list