Return-Path: X-Original-To: apmail-groovy-notifications-archive@minotaur.apache.org Delivered-To: apmail-groovy-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id B371B180D2 for ; Mon, 20 Jul 2015 14:33:06 +0000 (UTC) Received: (qmail 43695 invoked by uid 500); 20 Jul 2015 14:33:06 -0000 Delivered-To: apmail-groovy-notifications-archive@groovy.apache.org Received: (qmail 43673 invoked by uid 500); 20 Jul 2015 14:33:06 -0000 Mailing-List: contact notifications-help@groovy.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.incubator.apache.org Delivered-To: mailing list notifications@groovy.incubator.apache.org Received: (qmail 43664 invoked by uid 99); 20 Jul 2015 14:33:06 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jul 2015 14:33:06 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 1AE451A7359 for ; Mon, 20 Jul 2015 14:33:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.97 X-Spam-Level: X-Spam-Status: No, score=0.97 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-us-west.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id F8m91zUUyhlF for ; Mon, 20 Jul 2015 14:33:05 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-us-west.apache.org (ASF Mail Server at mx1-us-west.apache.org) with SMTP id F05982164D for ; Mon, 20 Jul 2015 14:33:04 +0000 (UTC) Received: (qmail 43178 invoked by uid 99); 20 Jul 2015 14:33:04 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 20 Jul 2015 14:33:04 +0000 Date: Mon, 20 Jul 2015 14:33:04 +0000 (UTC) From: =?utf-8?Q?C=C3=A9sar_Izurieta_=28JIRA=29?= To: notifications@groovy.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (GROOVY-7511) Static Compilation with implicit EnumMap doesn't use getter MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/GROOVY-7511?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] C=C3=A9sar Izurieta updated GROOVY-7511: ----------------------------------- Description:=20 When running this code: {code:title=3Dtest.groovy|borderStyle=3Dsolid} @groovy.transform.CompileStatic enum A { X } @groovy.transform.CompileStatic class Test1 { String x =3D "1" def getStringMap() { [ "x": x ] } def getEnumMap() { [ (A.X): x ] } } @groovy.transform.CompileStatic class Test2 extends Test1 { @Override String getX() { return "2" } } def test =3D new Test2() assert test.stringMap["x"] =3D=3D "2" assert test.enumMap[A.X] =3D=3D "2" {code} The second assert fails. The reason seems to be that the {{getEnumMap}} met= hod doesn't call {{this.getX()}} method but {{this.x}} directly. Removing the static compilation annotations makes the code work. was: When running this code: {code:title=3Dtest.groovy|borderStyle=3Dsolid} @groovy.transform.CompileStatic enum A { X } @groovy.transform.CompileStatic class Test1 { String x =3D "1" def getStringMap() { [ "x": x ] } def getEnumMap() { [ (A.X): x ] } } @groovy.transform.CompileStatic class Test2 extends Test1 { @Override String getX() { return "2" } } def test =3D new Test2() assert test.stringMap["x"] =3D=3D "2" assert test.enumMap[A.X] =3D=3D "2" {code} The second assert fails. The reason seems to be that the {{getEnumMap}} met= hod doesn't call {{this.getX()}} method but {{this.x}} directly. Removing the static compilation annotation makes the code work. > 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=C3=A9sar Izurieta > Assignee: C=C3=A9dric Champeau > Priority: Minor > > When running this code: > {code:title=3Dtest.groovy|borderStyle=3Dsolid} > @groovy.transform.CompileStatic > enum A { X } > @groovy.transform.CompileStatic > class Test1 { > String x =3D "1" > def getStringMap() { > [ "x": x ] > } > def getEnumMap() { > [ (A.X): x ] > } > } > @groovy.transform.CompileStatic > class Test2 extends Test1 { > @Override > String getX() { > return "2" > } > } > def test =3D new Test2() > assert test.stringMap["x"] =3D=3D "2" > assert test.enumMap[A.X] =3D=3D "2" > {code} > The second assert fails. The reason seems to be that the {{getEnumMap}} m= ethod doesn't call {{this.getX()}} method but {{this.x}} directly. > Removing the static compilation annotations makes the code work. -- This message was sent by Atlassian JIRA (v6.3.4#6332)