You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2020/11/11 02:02:05 UTC
[jira] [Closed] (GROOVY-9451) Unable to access static getter method
as field
[ https://issues.apache.org/jira/browse/GROOVY-9451?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King closed GROOVY-9451.
-----------------------------
> Unable to access static getter method as field
> ----------------------------------------------
>
> Key: GROOVY-9451
> URL: https://issues.apache.org/jira/browse/GROOVY-9451
> Project: Groovy
> Issue Type: Bug
> Components: groovy-runtime
> Affects Versions: 3.0.1, 3.0.2
> Reporter: Puneet Behl
> Assignee: Paul King
> Priority: Major
> Fix For: 3.0.3
>
>
> The field-like access for a static property does not work anymore. Following is the sample code which works in Groovy 2.x but fails in Groovy 3:
> {code}
> class MongoEntity {
> static String getDB() { "default" }
> }
> MongoEntity.DB // //throws groovy.lang.MissingPropertyException: No such property: DB for class: MongoEntity
> {code}
> *Please note* that if I change the method to {{getDb()}} then I can access the property as {{MongoEntity.db}}. Also, it works when `getDB()` is an instance method.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)