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

Allow static variables in Scripts

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Works for Me
    • None
    • None
    • Compiler

    Description

      While working on GROOVY-10077 I found out, that there is actual a use case for allowing static variables in a script when executed in the same JVM instance.

      One can always have a workaround like this:

      class Static {
          static staticProperty = 'I am static'
      }
      

      For example groovy.console.ui.view.MacOSXMenuBar.groovy had orgininally this code:

      static handler = false
      if (!handler) {
      

      ...which was replaced with GROOVY-3768 by this code (and made the variable useless for the originally intented purpose):

      def handler = false
      if (!handler) {
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              nineninesevenfour Harald Fassler
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: