groovy-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From César Izurieta (JIRA) <j...@apache.org>
Subject [jira] [Updated] (GROOVY-7511) Static Compilation with implicit EnumMap doesn't use getter
Date Mon, 20 Jul 2015 03:32:04 GMT

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

César Izurieta updated GROOVY-7511:
-----------------------------------
    Summary: Static Compilation with implicit EnumMap doesn't use getter  (was: Static Compilation
with explicit EnumMap doesn't use getter)

> Static Compilation with implicit EnumMap doesn't use getter
> -----------------------------------------------------------
>
>                 Key: GROOVY-7511
>                 URL: https://issues.apache.org/jira/browse/GROOVY-7511
>             Project: Groovy
>          Issue Type: Bug
>          Components: Compiler, Static compilation
>    Affects Versions: 2.4.4
>            Reporter: César Izurieta
>            Assignee: Cédric Champeau
>            Priority: Minor
>
> When running this code:
> {code:title=test.groovy|borderStyle=solid}
> @groovy.transform.CompileStatic
> enum A { X }
> @groovy.transform.CompileStatic
> class Test1 {
>     String x = "1"
>     def getStringMap() {
>         [ "x": x ]
>     }
>     def getEnumMap() {
>         [ (A.X): x ]
>     }
> }
> @groovy.transform.CompileStatic
> class Test2 extends Test1 {
>     @Override
>     String getX() {
>         return "2"
>     }
> }
> def test = new Test2()
> assert test.stringMap["x"] == "2"
> assert test.enumMap[A.X] == "2"
> {code}
> The second assert fails. The reason seems to be that the {{getEnumMap}} method doesn't
call {{this.getX()}} method but {{this.x}} directly.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message