On 26/08/20 1:51 AM, Jaroslav Tulach wrote:
Putting
module-info back on the shelf, I like the simplicity of -proc:full.
- hold on, module-info and annotation processors are actually deeply connected!
Yeah. That's why I finally(?) put module-info away at least until I better
understand what's going on with annotation processing. I had some confusion
because I was having problems using <annotationProcessorPaths> but that was
related to the compilation environment.

Wow, another twist. I didn't know, or had forgotten, about "uses" and "provides" in module-info to register annotation processors as a service implementation.

It's way past time I get a better understanding of module-info and annotation processing. The notes below are helpful to clarify things. For me, "-proc:full", is a convenience, not a necessity; using it avoids needing to enumerate all the
annotation processors.

While hacking into a combined jar file is easy and worked, I'm thinking that
pulling the sources into a standalone project is a better way to go. I can
even make AbstractServiceProviderProcessor sealed. ;-)

-ernie


- the old habit of putting the annotation processor next to the code
actually doesn't work with module-info well
- because `requires` should reflect the runtime environment of a module
- however when there is an annotation `Processor` then there are "two
runtime environments"
    - one when the JAR actually runs
    - one when its annotation processor runs
- such a "dual environment" cannot be expressed in module-info!
- as such the modern solution is to split annotation processor into
its own module JAR file
    - then the processor JAR `requires java.compiler` and co.
    - so it is ready for its "runtime inside of javac"
    - e.g. not the way openide-util-lookup & co. does it in NetBeans
- however when you split the annotation processor off the API JAR,
then `-proc:full` is no longer useful...

I guess the need for `-proc:full` option is a result of some CVE
reported to Java platform group. However even from point of
module-info the `-proc:full` option makes no sense.
-jt

---------------------------------------------------------------------
To unsubscribe, e-mail:[email protected]
For additional commands, e-mail:[email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to