Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A15C4200BB7 for ; Wed, 9 Nov 2016 13:20:50 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 9FFA2160AFD; Wed, 9 Nov 2016 12:20:50 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id E7BC6160AEE for ; Wed, 9 Nov 2016 13:20:49 +0100 (CET) Received: (qmail 91801 invoked by uid 500); 9 Nov 2016 12:20:48 -0000 Mailing-List: contact users-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@groovy.apache.org Delivered-To: mailing list users@groovy.apache.org Received: (qmail 91791 invoked by uid 99); 9 Nov 2016 12:20:48 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Nov 2016 12:20:48 +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 68AA81A7A5C for ; Wed, 9 Nov 2016 12:20:48 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 5.486 X-Spam-Level: ***** X-Spam-Status: No, score=5.486 tagged_above=-999 required=6.31 tests=[DKIM_ADSP_CUSTOM_MED=0.001, HTML_MESSAGE=2, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_NONE=-0.0001, SPF_SOFTFAIL=0.972, URI_HEX=1.313] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id zqr9Nmwa7Z0W for ; Wed, 9 Nov 2016 12:20:46 +0000 (UTC) Received: from mbob.nabble.com (mbob.nabble.com [162.253.133.15]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id BFD055F19B for ; Wed, 9 Nov 2016 12:20:45 +0000 (UTC) Received: from static.162.255.23.22.macminivault.com (unknown [162.255.23.22]) by mbob.nabble.com (Postfix) with ESMTP id 77CDF3599308 for ; Wed, 9 Nov 2016 04:11:36 -0800 (PST) Date: Wed, 9 Nov 2016 05:20:43 -0700 (MST) From: Krzysztof Kowalczyk To: users@groovy.incubator.apache.org Message-ID: <1478694043577-5736592.post@n5.nabble.com> Subject: Bug with closure() and compile static ? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_51499_258424706.1478694043588" archived-at: Wed, 09 Nov 2016 12:20:50 -0000 ------=_Part_51499_258424706.1478694043588 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi, So I run into a gotcha today: =E2=80=8Bimport groovy.transform.CompileStatic@CompileStaticclass Foo { = Closure c =3D { println "right closure" } Closure wrap =3D { println "wrap= ping closure" c() // stack overflow invoke wrap() instead of c() } = =20 def run(){ wrap() }}new Foo().run()=E2=80=8B So this example throws stack overflow exception if CompileStatic is used.= =20 It would run correctly with c.call() or without CompileStatic. Bug? Did found some things with stack overflow in Jira but nothing that looked the same. Regards, Krzysztof -- View this message in context: http://groovy.329449.n5.nabble.com/Bug-with-c= losure-and-compile-static-tp5736592.html Sent from the Groovy Users mailing list archive at Nabble.com. ------=_Part_51499_258424706.1478694043588 Content-Type: text/html; charset=UTF8 Content-Transfer-Encoding: quoted-printable Hi,
So I run into a gotcha today:
=E2=80=8Bimport groovy.transform.CompileStatic

@CompileStatic
class Foo {
    Closure c =3D { println "right closure" }
    Closure wrap =3D {=20
        println "wrapping closure"
        c() // stack overflow invoke wrap() instead of c()
    }

    def run(){
        wrap()
    }
}

new Foo().run()=E2=80=8B
So this example throws stack overflow exception if CompileStatic is used. <= br> It would run correctly with c.call() or without CompileStatic.

Bug? Did found some things with stack overflow in Jira but nothing that loo= ked the same.

Regards,
Krzysztof =09 =09 =09

View this message in context: Bug with closure() and= compile static ?
Sent from the Groovy Users mailing list archive at Nabble.com.
------=_Part_51499_258424706.1478694043588--