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 15322180CC for ; Mon, 20 Jul 2015 14:32:11 +0000 (UTC) Received: (qmail 42784 invoked by uid 500); 20 Jul 2015 14:32:08 -0000 Delivered-To: apmail-groovy-notifications-archive@groovy.apache.org Received: (qmail 42759 invoked by uid 500); 20 Jul 2015 14:32:08 -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 42750 invoked by uid 99); 20 Jul 2015 14:32:08 -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:32:07 +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 8A3951A7359 for ; Mon, 20 Jul 2015 14:32:07 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.77 X-Spam-Level: * X-Spam-Status: No, score=1.77 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, 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-eu-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 gRkxenJCbplE for ; Mon, 20 Jul 2015 14:32:06 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id 5AB042302F for ; Mon, 20 Jul 2015 14:32:05 +0000 (UTC) Received: (qmail 42737 invoked by uid 99); 20 Jul 2015 14:32: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:32:04 +0000 Date: Mon, 20 Jul 2015 14:32: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-7512) Cannot call Trait method from Closure when using static compilation 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-7512?page=3Dcom.atlassi= an.jira.plugin.system.issuetabpanels:all-tabpanel ] C=C3=A9sar Izurieta updated GROOVY-7512: ----------------------------------- Description:=20 When running: {code:title=3Dtest.groovy|borderStyle=3Dsolid} class X { Closure action =3D {} } trait T { void say(String text) { println text } @groovy.transform.CompileStatic X getX() { new X(action: { say "Hello!" }) } } class A implements T { } new A().x.action() {code} The following exception is thrown: {code} Caught: java.lang.ClassCastException: java.lang.Class cannot be cast to T java.lang.ClassCastException: java.lang.Class cannot be cast to T =09at T$Trait$Helper$_getX_closure1.doCall(Test2.groovy:14) =09at T$Trait$Helper$_getX_closure1.doCall(Test2.groovy) =09at Test2.run(Test2.groovy:23) {code} This is only happening on groovy 2.4.4. Removing the static compilation ann= otation or reverting to groovy version 2.4.3 makes the code work.=20 The commit that is causing this problem seems to be: 1bbed25aa3a08bc0cb7e14= e49a1e7c2b82f21a26 was: When running: {code:title=3Dtest.groovy|borderStyle=3Dsolid} class X { Closure action =3D {} } trait T { void say(String text) { println text } @groovy.transform.CompileStatic X getX() { new X(action: { say "Hello!" }) } } class A implements T { } new A().x.action() {code} The following exception is thrown: {code} Caught: java.lang.ClassCastException: java.lang.Class cannot be cast to T java.lang.ClassCastException: java.lang.Class cannot be cast to T =09at T$Trait$Helper$_getX_closure1.doCall(Test2.groovy:14) =09at T$Trait$Helper$_getX_closure1.doCall(Test2.groovy) =09at Test2.run(Test2.groovy:23) {code} The commit that is causing this seems to be: 1bbed25aa3a08bc0cb7e14e49a1e7c= 2b82f21a26 > Cannot call Trait method from Closure when using static compilation > ------------------------------------------------------------------- > > Key: GROOVY-7512 > URL: https://issues.apache.org/jira/browse/GROOVY-7512 > Project: Groovy > Issue Type: Bug > Components: Compiler, Static compilation, Static Type Checker > Affects Versions: 2.4.4 > Reporter: C=C3=A9sar Izurieta > Assignee: C=C3=A9dric Champeau > > When running: > {code:title=3Dtest.groovy|borderStyle=3Dsolid} > class X { > Closure action =3D {} > } > trait T { > void say(String text) { > println text > } > @groovy.transform.CompileStatic > X getX() { > new X(action: { > say "Hello!" > }) > } > } > class A implements T { > } > new A().x.action() > {code} > The following exception is thrown: > {code} > Caught: java.lang.ClassCastException: java.lang.Class cannot be cast to T > java.lang.ClassCastException: java.lang.Class cannot be cast to T > =09at T$Trait$Helper$_getX_closure1.doCall(Test2.groovy:14) > =09at T$Trait$Helper$_getX_closure1.doCall(Test2.groovy) > =09at Test2.run(Test2.groovy:23) > {code} > This is only happening on groovy 2.4.4. Removing the static compilation a= nnotation or reverting to groovy version 2.4.3 makes the code work.=20 > The commit that is causing this problem seems to be: 1bbed25aa3a08bc0cb7e= 14e49a1e7c2b82f21a26 -- This message was sent by Atlassian JIRA (v6.3.4#6332)