skinny85 / jilt

Java annotation processor library for auto-generating Builder (including Staged Builder) pattern classes
Other
240 stars 12 forks source link

Use javax.annotation.processing.Generated on newer versions of java #6

Closed Sineaggi closed 2 years ago

Sineaggi commented 2 years ago

The new j.a.p.Generated annotation has been available since java 9, and should be used instead of the old j.a.Generated annotation.

Under java 17, I see this exception

Caused by: java.lang.ClassNotFoundException: javax.annotation.Generated

Currently this can be worked around by adding the "javax.annotation:javax.annotation-api:1.3.2" dependency explicitly.

skinny85 commented 2 years ago

Thanks for opening the issue @Sineaggi!

The only thing that gives me pause about switching to javax.annotation.processing.Generated is that it's only available since Java 9, while currently Jilt can be used from Java 1.6 onwards.

Is it very inconvenient to add the dependency on javax.annotation:javax.annotation-api:1.3.2? Is it worth it to make Jilt only be usable from Java 9 onwards? I'm mostly worried about dropping support for Java 8, which I know is very popular.

Sineaggi commented 2 years ago

Is the pr I made acceptable? If you're compiling under java 9 (and above) it'll choose the new annotation. Under 9, it'll fall back to the older annotation.