Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-7362

Can't compile Java class extending Groovy abstract class with explicit GroovyObject interface

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.0
    • Fix Version/s: 3.0.0-alpha-4
    • Component/s: Compiler
    • Labels:
      None

      Description

      That's a more advanced version of GROOVY-3877

      Compile classes.groovy:

      abstract class AbstractClass extends ConcreteClass implements GroovyObject {}
      
      class ConcreteClass {}
      

      Then compile JavaClass.java:

      public class JavaClass extends AbstractClass {}
      

      You get:

      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

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                paulk Paul King
                Reporter:
                gromopetr Peter Gromov
              • Votes:
                2 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: