On 22/04/2016 19:55, Sanne Grinovero wrote:
Hello all,

related to https://bugs.openjdk.java.net/browse/JDK-8152842

I'm having to patch our annotation processors to avoid the @Generated
annotation, as I can't use the proposed workaround to use `-addmods
java.annotations.common`: our build also requires `-target 1.7` and
the two options are not compatible.

But I hope this will be only very short term? I'm only working this
around temporarily so that I can keep testing other more interesting
aspects of Jigsaw, but ultimately we'll need that annotation back.

Thanks,
Sanne
There's two issues here.

One is that when you run `javac` then the you are essentially executing the jdk.compiler module. This module is resolved at startup and the transitively closure (+ services) is restricting the set of modules that can be read by your annotation processor (that is in its own unnamed module). We had a small update that we need to do in JEP 261 to support this and at the same time align with the updated policy on root modules when executing code in the unnamed module. So assume that `javac`, `javadoc` and several other tools will be updated with this soon.

The other issue is specific to the java.corba module and the 5 modules that are shared with Java EE. These are not resolved by default so this is why `-addmods` (or `-J-addmods` if javac -processor and the annotation processor needs the module to be resolved) is needed. In the other thread then you are happy that the EE version of Java Transaction API is located in preference to the subset in the JDK, in this case you want the Java SE subset of the Common Annotations. It's impossible to fix all cases without going back to split packages again.

On combing options then if you are compiling with `-target 1.7` then I assume you must be also specifying `-source 1.7` and `-bootclasspath ...` and so `-addmods` isn't in the picture. Better still then `javac -release 7` should do it.

On the other hand, if this its the annotation processor using @Generated then I would expect this should work:
    -J-addmods -Jjava.annotations.common -processor ... -release 7

The -J is the way to pass options through to the underlying runtime (or execution environment in javac speak).

-Alan

Reply via email to