Groovy
  1. Groovy
  2. GROOVY-7620

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.4.5
    • Fix Version/s: 2.4.7
    • Component/s: Compiler
    • Labels:
      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.

        Issue Links

          Activity

          Hide
          ASF GitHub Bot added a comment -

          GitHub user paulk-asert opened a pull request:

          https://github.com/apache/groovy/pull/342

          GROOVY-7620: No error if abstract getter is not implemented but stati…

          …c field exists

          You can merge this pull request into a Git repository by running:

          $ git pull https://github.com/paulk-asert/groovy groovy7620

          Alternatively you can review and apply these changes as the patch at:

          https://github.com/apache/groovy/pull/342.patch

          To close this pull request, make a commit to your master/trunk branch
          with (at least) the following in the commit message:

          This closes #342


          commit 82bf31eac1b3a451f529fe50c35c4e2af93100a6
          Author: paulk <paulk@asert.com.au>
          Date: 2016-05-31T11:14:54Z

          GROOVY-7620: No error if abstract getter is not implemented but static field exists


          Show
          ASF GitHub Bot added a comment - GitHub user paulk-asert opened a pull request: https://github.com/apache/groovy/pull/342 GROOVY-7620 : No error if abstract getter is not implemented but stati… …c field exists You can merge this pull request into a Git repository by running: $ git pull https://github.com/paulk-asert/groovy groovy7620 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/groovy/pull/342.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #342 commit 82bf31eac1b3a451f529fe50c35c4e2af93100a6 Author: paulk <paulk@asert.com.au> Date: 2016-05-31T11:14:54Z GROOVY-7620 : No error if abstract getter is not implemented but static field exists
          Hide
          ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

          https://github.com/apache/groovy/pull/342

          Show
          ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/groovy/pull/342
          Hide
          Paul King added a comment -

          Proposed PR applied

          Show
          Paul King added a comment - Proposed PR applied

            People

            • Assignee:
              Paul King
              Reporter:
              Sergei Egorov
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development