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

DGM: getMetaPropertyValues and getProperties includes private entries

    XMLWordPrintableJSON

Details

    • Question
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 5.0.0-alpha-1
    • None
    • None

    Description

      Consider the following:

      class C {
        private getX() {}
        protected getY() {}
        @groovy.transform.PackageScope getZ() {}
      }
      
      C.metaClass.properties.each {
        println it.name + ': ' + org.codehaus.groovy.ast.AstToTextHelper.getModifiersText(it.modifiers)
      }
      

      The metaClass properties includes all visibilities. And the example could probably be extended to show static stuff as well.

      class: public final native
      z: <package-private>
      y: protected
      x: private
      

      These properties are used (unfiltered) to generate the results for DefaultGroovyMethods getMetaPropertyValues and getProperties. GROOVY-5169 and GROOVY-7682 are partially caused by this.

      Should the extension methods return private properties?

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: