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

No error if abstract getter is not implemented but static field exists

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.5
    • 2.4.7
    • Compiler
    • None

    Description

      Code example:

      abstract class A {
         abstract Object getFoo();
      
         void test() {
             println getFoo();
         }
      }
      
      class B extends A {
         static Object foo;
      }
      
      new B().test()
      
      
      /*
      java.lang.AbstractMethodError: A.getFoo()Ljava/lang/Object;
      at A.test(Script1.groovy:5)
      at A$test.call(Unknown Source)
      at Script1.run(Script1.groovy:14)
      */
      

      CompileStatic will not report an error as well.

      Attachments

        Issue Links

          Activity

            People

              paulk Paul King
              bsideup Sergei Egorov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: