[ 
https://issues.apache.org/jira/browse/GROOVY-4647?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17755685#comment-17755685
 ] 

jonny commented on GROOVY-4647:
-------------------------------

For what it's worth, I've observed a problem like this in Groovy 4.0.8, so this 
remains a live bug in a post-parrot world.

> A class using the @Delegate annotation does not implement the delegate's 
> interfaces from the Java side when join compiling 
> ---------------------------------------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-4647
>                 URL: https://issues.apache.org/jira/browse/GROOVY-4647
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler, Stub generator / Joint compiler
>    Affects Versions: 1.7.6, 1.8-beta-3, 2.4.0-rc-1
>            Reporter: Travis Schneeberger
>            Priority: Major
>
> 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:
> {code}
> //groovy code
> class DelegateWeirdness {
>   @Delegate
>   private Collection l = new ArrayList();
> }
> {code}
> {code}
> //java code
> public class DelegateWierdnessClient {
>     Collection c = new DelegateWeirdness();
> }
> {code}
> {code}
> 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
> {code}  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to