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

problem trying to extend an abstract groovy class with a java class

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: 1.6.5, 1.7-beta-2
    • Fix Version/s: 1.6.6, 1.7-rc-1
    • Component/s: None
    • Labels:
      None

      Description

      Take a simple abstract groovy class:

      --- Foo.groovy
      abstract class Foo {}
      ---
      

      compile it with groovyc. Take a simple java class

      --- FooSub.java
      class FooSub extends Foo {}
      ---
      

      try and compile it with javac. It will fail because the GroovyObject methods added to Foo are marked synthetic so it doesn't think GroovyObject has been implemented in the hierarchy. Neither javac or the Eclipse Compiler for Java (ECJ) allow synthetic methods to satisfy an interface implementation (and Foo has had GroovyObject added to it by groovyc). It is the word 'abstract' on Foo that causes both javac and ECJ to check this situation and report the problem.

      I've discussed things with Jochen and we are thinking about removing synthetic for these methods if they are being added to a groovy type that is abstract.

      Joint compilation works because the stubs don't show that the methods will be abstract when the java code is compiled.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                blackdrag Jochen Theodorou
                Reporter:
                aclement Andy Clement
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: