[jira] [Commented] (GROOVY-7362) Can't compile Java class extending Groovy abstract class with explicit GroovyObject interface

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[jira] [Commented] (GROOVY-7362) Can't compile Java class extending Groovy abstract class with explicit GroovyObject interface

JIRA jira@apache.org

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

Paul King commented on GROOVY-7362:
-----------------------------------

Removing 2_5_X fix version for now since GROOVY-8495 was removed for now from 2_5_X. We can add a 2.5.x fix version if/when we backport GROOVY-8495 to 2_5_X.

> Can't compile Java class extending Groovy abstract class with explicit GroovyObject interface
> ---------------------------------------------------------------------------------------------
>
>                 Key: GROOVY-7362
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7362
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler
>    Affects Versions: 2.4.0
>            Reporter: Peter Gromov
>            Assignee: Paul King
>            Priority: Major
>             Fix For: 3.0.0-alpha-4
>
>
> That's a more advanced version of GROOVY-3877
> Compile classes.groovy:
> {code}
> abstract class AbstractClass extends ConcreteClass implements GroovyObject {}
> class ConcreteClass {}
> {code}
> Then compile JavaClass.java:
> {code}
> public class JavaClass extends AbstractClass {}
> {code}
> You get:
> {quote}
> JavaClass.java:1: error: JavaClass is not abstract and does not override abstract method setMetaClass(MetaClass) in GroovyObject
> public class JavaClass extends AbstractClass {
>        ^
> 1 error
> {quote}
> That's likely because setMetaClass is added as a synthetic method in ConcreteClass and not overridden in AbstractClass.
> This also happens without explicit GroovyObject interface when using joint compilation (https://youtrack.jetbrains.com/issue/IDEA-137722#comment=27-952814). Before generating stubs, "implements GroovyObject" is added to Groovy classes, and if it so happens that AbstractClass is visited before ConcreteClass, then "implements GroovyObject" will be added to both Groovy classes, but the (synthetic) implementations somehow end up being only in ConcreteClass.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)