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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.6.5, 1.7-beta-2
    • 1.6.6, 1.7-rc-1
    • None
    • 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

        1. verifier_patch.txt
          3 kB
          Andy Clement

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: