Question about jdk.internal.HotSpotIntrinsicCandidate

Stephane Epardaud stef at
Wed Dec 2 10:16:32 UTC 2015

On 01/12/15 22:04, Alex Buckley wrote:
> 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.

But I thought that Java 9 would check that you can't export a type
outside the module without also exporting the types it exposes? Like
public method return and parameter types. Can't remember where I read
that, though… Is that planned or not?

As for annotations, I understand that's a little less clear because it
doesn't exactly belong to the class' signature. I do wonder if that's
not going to break modular class loaders if for example a module uses
JPA annotations but does not export the dependency, and if another
module scans your module for JPA annotations it won't see them if they
use different ClassLoaders (which is possible in theory since the
dependency was not exported).

For some annotations (like HotspotIntrisic) it may be desirable to have
it private, but for "framework" annotations like JPA, I _think_ it makes
more sense to force (and check) the JPA dependency to be exported, no?

More information about the jigsaw-dev mailing list