Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
1.7.6, 1.8-beta-3, 2.4.0-rc-1
-
None
-
None
Description
A class using the @Delegate annotation does not implement the delegate's interfaces from the Java side when joint compiling. The workaround for this is using a cast. This is confusing when working on mixed java/groovy projects. When inspecting the generated class file, the class doing the delegation does indeed implement the correct interfaces so I'm guessing it has something to do with the stub generation.
See the following example:
//groovy code class DelegateWeirdness { @Delegate private Collection l = new ArrayList(); }
//java code public class DelegateWierdnessClient { Collection c = new DelegateWeirdness(); }
C:\IdeaProjects\groovy-bugs>groovyc -j src\main\groovy\DelegateWeirdness.groovy src\main\java\DelegateWierdnes
sClient.java
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Compile error during compilation with javac.
C:\IdeaProjects\groovy-bugs\src\main\java\DelegateWierdnessClient.java:4: incompatible types
found : DelegateWeirdness
required: java.util.Collection
Collection c = new DelegateWeirdness();
^
1 error
1 error
Attachments
Issue Links
- is related to
-
GROOVY-7764 Joint compilation does not work with AST-transformed Groovy
- Open
- relates to
-
GROOVY-6865 @Delegate does not work with generated stubs
- Open