RFR: JDK-8306819: Consider disabling the compiler's default active annotation processing

David M. Lloyd duke at openjdk.org
Mon Sep 11 17:12:40 UTC 2023


On Sun, 10 Sep 2023 15:51:37 GMT, Josiah Noel <duke at openjdk.org> wrote:

> > This aims to avoid unintentional AP pollutions in classpath, like if one AP is present in a dependency and thus your classpath but you don't want it to run.
> 
> In practice is this a thing that happens? Most processors I've seen (like Lombok or record builder for example) are typically added as provided or optional scope dependencies. (and so cannot be transitively pulled)

In fact this is a thing that can cause problems. At present, annotation processor authors have to be cautious about including dependencies because commonly used libraries (such as Guava or Eclipse Collections) can conflict with other processors and/or the user's project with surprising (and sometimes subtle) results.

I'm not sure about other build tools, but Maven does supply a means to include an annotation processor on a (relatively) isolated class path, i.e. separately from the application's class path. Though this is somewhat more cumbersome, it is certainly safer.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/14432#issuecomment-1714275968


More information about the compiler-dev mailing list