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

Package-private field and method or property have different treatment

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 5.0.0-alpha-9
    • None

    Description

      Follow up from GROOVY-11356. Package-private members produce different results. Consider the following:

      package p
      
      import groovy.transform.*
      
      abstract class A {
        @PackageScope final foo = 'foo'
        @PackageScope getBar() { 'bar }
      }
      
      // not package p
      
      class C extends p.A {
        void test() {
          print getBar() // prints "bar"
          print bar // also prints "bar"
          print foo // throws MissingPropertyException
        }
      }
      

      Attachments

        Activity

          People

            emilles Eric Milles
            emilles Eric Milles
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: