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

CompileStatic when accessing parent class static properties produces access forbidden message with incorrect line number info

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.2, 2.3.0, 2.3.1, 2.4.0-rc-1
    • 2.4.3
    • Static compilation
    • None

    Description

      The following:

      import groovy.transform.*
      
      @CompileStatic
      class Foo {
         static bar = "hello"
      }
      
      @CompileStatic
      class Bar extends Foo{
         static something() {
             println bar
         }
      }
      new Bar().something()
      

      Produces:

      Access to java.lang.Object#bar is forbidden at line: -1, column: -1
      

      Changing the println to:

             println getBar()
      

      fixes the problem, but shouldn't be necessary.

      In addition, even if using only 'bar' was to be forbidden, the line number information is incorrect

      Attachments

        Activity

          People

            paulk Paul King
            graemerocher Graeme Rocher
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: