Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-3010 fix private field visibility
  3. GROOVY-1063

No access protection for private static fields

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1-beta-2
    • None
    • groovy-runtime
    • None
    • Windows XP, Java 1.5, also Ubuntu 7.04 "Feisty Fawn" (JDK 1.6.0) + Groovy Subversion r6911

    Description

      Groovysh lets you set & read private member fields, as long as they're static:

      groovy> class C

      { private static x }

      groovy> C.x = new Integer(10)
      groovy> println C.x
      groovy> go
      10

      Note that it doesn't let you access regular private fields:

      groovy> class B

      { private x }

      groovy> b = new B()
      groovy> b.x = new Integer(10)
      groovy> go
      Caught: groovy.lang.IllegalPropertyAccessException: Can not access the
      private field x in class B

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mcspanky Martin C. Martin
              Votes:
              8 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated: