IllegalAccessError even when -XaddExports adds ALL-UNNAMED to the reported module/package
Roel Spilker
r.spilker at gmail.com
Thu Dec 3 23:26:19 UTC 2015
Hi,
I have a problem using -XaddExports in jigsaw build 94. This is the first
build I tried so I don't know if the problem also occurs in earlier
versions.
In Lombok we use unsupported internal APIs (yes at our own risk)
After reading the instructions on http://openjdk.java.net/jeps/261
"Breaking encapsulation" I've added the -XaddExports flag. The exception I
got luckily gave me the module name as well as the package to export.
However I still got the same exception (details below).
Am I doing something wrong (apart from using unsupported internal APIs)? Is
the exception wrong?
Roel
$ java -version
java version "1.9.0-ea"
Java(TM) SE Runtime Environment (build
1.9.0-ea-jigsaw-nightly-h403-20151201-b94)
Java HotSpot(TM) 64-Bit Server VM (build
1.9.0-ea-jigsaw-nightly-h403-20151201-b94, mixed mode)
$ javac
-XaddExports:jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED -cp
lombok.jar Test.java
An annotation processor threw an uncaught exception.
Consult the following stack trace for details.
java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in
module: Unnamed Module) cannot access class
com.sun.tools.javac.processing.JavacProcessingEnvironment (in module:
jdk.compiler), com.sun.tools.javac.processing is not exported to Unnamed
Module
at lombok.javac.apt.LombokProcessor.init(LombokProcessor.java:84)
at
lombok.core.AnnotationProcessor$JavacDescriptor.want(AnnotationProcessor.java:87)
at
lombok.core.AnnotationProcessor.init(AnnotationProcessor.java:141)
at
lombok.launch.AnnotationProcessorHider$AnnotationProcessor.init(AnnotationProcessor.java:53)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment$ProcessorState.<init>(jdk.compiler at 9.0
/JavacProcessingEnvironment.java:669)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment$DiscoveredProcessors$ProcessorStateIterator.next(jdk.compiler at 9.0
/JavacProcessingEnvironment.java:766)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(jdk.compiler at 9.0
/JavacProcessingEnvironment.java:857)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment.access$2100(jdk.compiler at 9.0
/JavacProcessingEnvironment.java:104)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(jdk.compiler at 9.0
/JavacProcessingEnvironment.java:1183)
at
com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(jdk.compiler at 9.0
/JavacProcessingEnvironment.java:1291)
at
com.sun.tools.javac.main.JavaCompiler.processAnnotations(jdk.compiler at 9.0
/JavaCompiler.java:1247)
at com.sun.tools.javac.main.JavaCompiler.compile(jdk.compiler at 9.0
/JavaCompiler.java:921)
at com.sun.tools.javac.main.Main.compile(jdk.compiler at 9.0
/Main.java:261)
at com.sun.tools.javac.main.Main.compile(jdk.compiler at 9.0
/Main.java:143)
at com.sun.tools.javac.Main.compile(jdk.compiler at 9.0/Main.java:56)
at com.sun.tools.javac.Main.main(jdk.compiler at 9.0/Main.java:42)
More information about the jigsaw-dev
mailing list