Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-4683 static import collection task
  3. GROOVY-3358

static imports don't work for statically defined getters (property access)

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • None
    • None
    • Compiler
    • None

    Description

      So I have a class that defines:

      public static Environment getCurrentEnvironment()
      

      I use this class like:

      import static grails.util.Environment.*
      

      However this throws a MPE:

      println currentEnvironment
      

      whilst this works

      println getCurrentEnvironment()
      

      Seems wrong that propery notation should work for a static getter when it works when used directly:

      import grails.util.Environment
      
      println Environment.currentEnvironment
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            graemerocher Graeme Rocher
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: