@CompileClasspath vs. @Classpath usage

Why is AbstractCompile#getClasspath() annotated only with @Classpath instead of with @CompileClasspath?

JavaCompile#getClasspath() is annotated with @CompileClasspath, but GroovyCompile doesn’t have an equivalent override. It does have getGroovyClasspath() (which is annotated with @Classpath), so I would expect any members of classpath for Groovy to only be used for their ABI, and any members of groovyClasspath to be actually used by the groovyc (or whatever it’s called) runtime (I’d expect that groovyClasspath members would have their full class contents, instead of just their ABI, checked for up-to-date checks).

Hi Ross,

the problem here is that Groovy comes with some AST transformations which do not only depend on the Java ABI of a class but also on the implementation of the class. This is why we can use @CompileClasspath only for Java compilation without annotation processors.

IOW, @CompileClasspath is actually tailored to things which have an effect on javac, the Java compiler. It is not built to detect changes which affect the Groovy compiler.

Cheers,
Stefan

1 Like