You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Maciej Gawinecki (JIRA)" <ji...@apache.org> on 2017/09/22 12:17:00 UTC

[jira] [Commented] (GROOVY-4647) A class using the @Delegate annotation does not implement the delegate's interfaces from the Java side when join compiling

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

Maciej Gawinecki commented on GROOVY-4647:
------------------------------------------

[~melix] How is the progress on resolving this issue? There has been 6 years since the issue has been reported and 3 years since it has been last commented.

> 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
>
> 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
(v6.4.14#64029)