You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Puneet Behl (Jira)" <ji...@apache.org> on 2020/03/09 12:42:00 UTC

[jira] [Created] (GROOVY-9451) Unable to access static getter method as field

Puneet Behl created GROOVY-9451:
-----------------------------------

             Summary: 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-jdk
    Affects Versions: 3.0.2, 3.0.1
            Reporter: Puneet Behl


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
{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)