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

Javac doesn't see synthetic Groovy methods in Groovy-compiled superclass

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.6-rc-2
    • 1.6.6, 1.7-rc-1
    • None
    • None

    Description

      Create a Foo.groovy class containing:

      abstract class Foo {}

      and Bar.java with:

      class Bar extends Foo {}.

      After that you compile the first file with groovyc (1.6) and the other one
      with javac (1.5 or 1.6):

      C:\sdks\groovy-1.6-RC-1>set GROOVY_HOME=c:\sdks\groovy-1.6-RC-1\

      C:\sdks\groovy-1.6-RC-1\bin>set path=c:\sdks\groovy-1.6-RC-1\bin\;%path%

      C:\temp>groovyc Foo.groovy

      C:\temp>c:\jdk1.5.0_08\bin\javac.exe -classpath c:\sdks\groovy-1.6-RC-1\embeddable\groovy-all-1.6-RC-1.jar;. Bar.java
      Bar.java:1: Bar is not abstract and does not override abstract method setMetaClass(groovy.lang.MetaClass) in groovy.lang.GroovyObject
      class Bar extends Foo {}
      ^
      1 error

      Foo.jad contains the required setMetaClass method, but it's synthetic. Javac doesn't consider synthetic methods to be the ones already implementing what it wants. The abstractness of Foo is important, otherwise everything works. The same may apply not only to GroovyObject MOP methods, but also to generated property accessors.

      Attachments

        Issue Links

          Activity

            People

              blackdrag Jochen Theodorou
              gromopetr Peter Gromov
              Votes:
              2 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: