Apologies if this has already been answered elsewhere, but I couldn't find anything in the issues.
Is it possible to disable the addition of javax.annotation.Generated annotations to generated types? This causes issues on JDK 9, requiring either the modularization of the program (in order to specify a dependency on the java.xml.ws.annotation module), or the use of --add-modules. I am aiming for full modularization of all of my software, but to be honest, I'd just rather not have the dependency on java.xml.ws.annotation at all.
Thank you for raising this. Currently, we're only generating javax.annotation.Generated annotations if it's found on the classpath. The strangeness here is that it can still found it on the classpath while module path does not allow to reference it. Unfortunately, I have no idea what actually happening there as I still haven't get my hands on java 9 and all the stuff. One thing that you can try, at least temporarily, is the special mechanism for inhibiting classes from being found on the classpath by Immutables, please, see #566
Thanks, I'll try inhibiting the classes.
I think all that's happening is just what's always been happening to date: The annotations are on the classpath, and immutables is finding them. The classpath isn't gone in Java 9, after all...
Inhibiting works well! I'll close this issue for now.
Looks like vavr have decided to dump the annotation entirely:
@io7m I feel we would, probably, do the same, moreover, they introduced a new one Generated in a different package (https://docs.oracle.com/javase/9/docs/api/javax/annotation/processing/Generated.html). So it seems like a bad joke now. In reality, there's no adequate usage for it, except as a fancy decoration.
The only use I find out of it is knowing where/how the generated code originated, so that you know what file to go and edit. So it serves purpose for documentation/diagnostics, but no practical usage beyond that.
Google Error Prone looks at javax.annotation.Generated for its -XepDisableWarningsInGeneratedCode flag. That is very useful. Hopefully an alternative mechanism can be agreed upon.
Fully agree, but documenting generated code can be done in comments, and Error Prone should also support the new annotation, probably. It was actually hilarious to watch as in one of this year's JavaOne sessions presenters showed javax.annotation.processing.Generated as something cool, super-useful and as it was never seen before...
Seems javax.annotation.Generated's days will soon be over, at least on Java 9
I filed google/error-prone#811 for the Error Prone team's point of view.
Most helpful comment
I filed google/error-prone#811 for the Error Prone team's point of view.