In the attached test case (cd mod; gradle clean build), I have a parent module with two child modules. The first module simply defines a simple AnnotationCollector. The second module is structured so that it will generate a java stub for a groovy file that uses the 'external' annotation collector. When the generated java stub for ParentG is compiled, it throws the following exception:
:mod2:compileGroovyC:\sand\nca\javacommons\nca\harmonytest\mod\mod2\build\tmp\groovy-java-stubs\mod2\ParentG.java:10: error: incompatible types: ExternalAnnotationCollector cannot be converted to Annotation
@mod1.ExternalAnnotationCollector() public class ParentG
It appears that the java compilation of the groovy stub does not have the external AnnotationCollector 'in scope' of the compiler, and thus barfs. However, if the AnnocationCollector is in the same module as where it used, the compilation works (uncomment the obvious line in ParentG and rebuild).
This seems related to https://jira.codehaus.org/browse/GRECLIPSE-1679
Added Sept. 4th:
Also related to http://jira.codehaus.org/browse/GROOVY-6635 which was closed as 'not reproducible' - believe the test case with this issue effectively reproduces the issue (and 6635's as well)