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

Unable to extend abstract Java base class in Groovy, but works from Groovyc

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-3
    • 1.1-rc-3
    • None
    • None

    Description

      The example below works as expected (printing 1) when main is invoked after running groovyc. The same code fails to work correctly, throwing an AbstractMethodError, when the script is running using groovy.

      — Base.java ---------------------
      abstract public class Base
      {
      abstract int foo();
      }

      -Subclass1.groovy-------------
      class Subclass1 extends Base
      {
      int foo()

      { return 1; }

      // when invoked after running groovyc, this works correctly
      static void main(String[] args)

      { Base b = new Subclass1(); System.out.println(b.foo()); }

      }

      Base b = new Subclass1();
      System.out.println(b.foo());

      // when invoked via groovy on the command line, this fails.
      // "Caught: java.lang.AbstractMethodError: Subclass1.foo()I"

      Attachments

        1. bug1079.zip
          0.5 kB
          Andres Almiray

        Activity

          People

            Unassigned Unassigned
            philbo Phillip Bogle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: