On 20/05/2016 16:55, Aleksey Shipilev wrote:
Hi,

I have a weird use case in jcstress around @Contended.

In order to support both JDK 8 and JDK 9 we build against *our own*
sun.misc.Contended and jdk.internal.annotations.Contended. This works
arguably well for both compiling and running with both JDK 8 and JDK 9:
the real annotation gets picked up from the JDK.

However, since JDK 9b118 we cannot build anymore, because:

LongResult1_jcstress.java:[3,13] error: Contended is not visible because
package sun.misc is not visible

...even though sun/misc/Contended.java is right here in my source tree.
Is there a magic incantation to make javac proceed? The usual tricks did
not help (probably because the target class is not in jdk.unsupported,
but rather in the source tree itself):
   -addmods jdk.unsupported
   -XaddExports:jdk.unsupported/sun.misc=ALL-UNNAMED
   -XaddReads:jdk.unsupported=ALL-UNNAMED

jcstress is boot loader so I assume multi-release JARs are out of the question?

So what is the javac command that you are using? If you are compiling sun/misc/Contented.java then I would expect to see `javac -Xmodule:jdk.unsupported` so that it is compiled "as if" part of the jdk.unsupported module.

-Alan

Reply via email to