You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Daniel Sun (JIRA)" <ji...@apache.org> on 2019/01/25 18:03:00 UTC

[jira] [Updated] (GROOVY-3358) static imports don't work for statically defined getters (property access)

     [ https://issues.apache.org/jira/browse/GROOVY-3358?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Sun updated GROOVY-3358:
-------------------------------
    Fix Version/s:     (was: 3.x)
                   4.x

> static imports don't work for statically defined getters (property access)
> --------------------------------------------------------------------------
>
>                 Key: GROOVY-3358
>                 URL: https://issues.apache.org/jira/browse/GROOVY-3358
>             Project: Groovy
>          Issue Type: Sub-task
>          Components: Compiler
>            Reporter: Graeme Rocher
>            Priority: Major
>             Fix For: 4.x
>
>
> So I have a class that defines:
> {code}
> public static Environment getCurrentEnvironment()
> {code}
> I use this class like:
> {code}
> import static grails.util.Environment.*
> {code}
> However this throws a MPE:
> {code}
> println currentEnvironment
> {code}
> whilst this works
> {code}
> println getCurrentEnvironment()
> {code}
> Seems wrong that propery notation should work for a static getter when it works when used directly:
> {code}
> import grails.util.Environment
> println Environment.currentEnvironment
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)