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

public static variables not modifiable by top-level inner classes

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.0-JSR-5
    • 1.0-JSR-5
    • None
    • None
    • Windows XP Professional SP2
      Sun Java JDK 1.5.0_07

    Description

      I was testing issues around Nested and Inner classes, and I came up with the attached Groovy script that producse unexpected output.

      Actual Ouput:
      In OuterClass constructor
      globalVar = globalVar 1
      globalVar = globalVar 1
      outerClassVar = outerClassVar

      Expected Output:
      In OuterClass constructor
      globalVar = globalVar 1
      globalVar = globalVar 4
      outerClassVar = outerClassVar

      It appears that public static variables are not modifiable outside the class in which they are defined.

      Attachments

        1. NestedClassTest.groovy
          2 kB
          Mike McAngus

        Activity

          People

            guillaume Guillaume Sauthier
            mcangus Mike McAngus
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: