gradle-processors icon indicating copy to clipboard operation
gradle-processors copied to clipboard

Processors 2.0.0 do not work well with immutables

Open maciekf opened this issue 7 years ago • 3 comments

To upgrade gradle-processors to 2.0.0 I had to add a compile dependency on immutables, otherwise the compilation would fail with warning:

warning: unknown enum constant ImplementationVisibility.PACKAGE reason: class file for org.immutables.value.Value$Style$ImplementationVisibility not found error: warnings found and -Werror specified

Another issue is that after upgrading to 2.0.0 immutable classes which depend on conjure generated classes do not rebuild properly when conjure changes.

maciekf avatar Nov 07 '18 10:11 maciekf

This is the Gradle annotation processors approach. They would have you add the immutables annotations to your classpath (it can/should be compileOnly)

j-baker avatar Nov 07 '18 10:11 j-baker

Here's where they introduced this feature: https://docs.gradle.org/4.6/release-notes.html#convenient-declaration-of-annotation-processor-dependencies

They go into it a bit more in the blog post linked there, but the gist is that only annotations (e.g. Value.Immutable) need to be on the compile classpath (and even these can mostly be on compileOnly if they're just @Retention(RetentionPolicy.SOURCE) annotations)

dansanduleac avatar Nov 07 '18 11:11 dansanduleac

Immutables says its annotations are needed in jar files for incremental compilation, but I'm uncertain what issue they're specifically working around or if it's actually necessary. Perhaps file a bug on them to have it looked at again?

alicederyn avatar Nov 07 '18 12:11 alicederyn