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

MetaClass.getProperites() returns package private fields

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Information Provided
    • 4.0.1
    • None
    • None
    • None

    Description

      According to https://issues.apache.org/jira/browse/GROOVY-10449 public fields should now be included in the result of `MetaClass.getProperites()`. However, it seems that with Groovy 4.0.1 package private fields are also returned.

      Steps to reproduce

      Take this code:

      println "Groovy ${GroovySystem.version}"
      
      GroovySystem.getMetaClassRegistry().getMetaClass(LinkedHashMap).properties.forEach { prop ->
          println "${prop.name} - ${prop.class.simpleName}"
      }
      

       
      With Groovy 3.0.10 it prints:

      Groovy 3.0.10
      class - MetaBeanProperty
      empty - MetaBeanProperty
      

       
      With 4.0.1 it prints:

      Groovy 4.0.1
      keySet - CachedField
      values - CachedField
      DEFAULT_INITIAL_CAPACITY - CachedField
      MAXIMUM_CAPACITY - CachedField
      DEFAULT_LOAD_FACTOR - CachedField
      TREEIFY_THRESHOLD - CachedField
      UNTREEIFY_THRESHOLD - CachedField
      MIN_TREEIFY_CAPACITY - CachedField
      table - CachedField
      entrySet - CachedField
      size - CachedField
      modCount - CachedField
      threshold - CachedField
      loadFactor - CachedField
      serialVersionUID - CachedField
      head - CachedField
      tail - CachedField
      accessOrder - CachedField
      class - MetaBeanProperty
      empty - MetaBeanProperty
      

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              lptr Lóránt Pintér
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: