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 290B718D93 for ; Wed, 22 Jul 2015 13:35:09 +0000 (UTC) Received: (qmail 9920 invoked by uid 500); 22 Jul 2015 13:35:09 -0000 Delivered-To: apmail-groovy-notifications-archive@groovy.apache.org Received: (qmail 9897 invoked by uid 500); 22 Jul 2015 13:35:09 -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 9888 invoked by uid 99); 22 Jul 2015 13:35:09 -0000 Received: from Unknown (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jul 2015 13:35:09 +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 852F71A7666 for ; Wed, 22 Jul 2015 13:35:08 +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 mPZDyfdwVYKY for ; Wed, 22 Jul 2015 13:35:07 +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 B036E20D14 for ; Wed, 22 Jul 2015 13:35:06 +0000 (UTC) Received: (qmail 9597 invoked by uid 99); 22 Jul 2015 13:35:05 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Jul 2015 13:35:05 +0000 Date: Wed, 22 Jul 2015 13:35:05 +0000 (UTC) From: "Jochen Kemnade (JIRA)" To: notifications@groovy.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GROOVY-7156) Builders behave strange when closures throw exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/GROOVY-7156?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14636907#comment-14636907 ] Jochen Kemnade commented on GROOVY-7156: ---------------------------------------- And groovy-binary-2.5.0-20150722.114831-291.zip is affected too. > Builders behave strange when closures throw exceptions > ------------------------------------------------------ > > Key: GROOVY-7156 > URL: https://issues.apache.org/jira/browse/GROOVY-7156 > Project: Groovy > Issue Type: Bug > Affects Versions: 2.3.7, 2.4.0-rc-2, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4 > Reporter: Jochen Kemnade > Attachments: groovy-7156.zip > > > I noticed some strange behavior when closures inside a builder throw exceptions: > {code} > import groovy.transform.TypeChecked > @TypeChecked > class TestBuilder extends BuilderSupport { > Object createNode(Object name, Map map){ > println "Create node $name: $map" > new Node(null, name, map) > } > Object createNode(Object name){ > println "Create node $name" > new Node(null, name) > } > Object createNode(Object name, Object value){ > println "Create node $name, value $value" > new Node(null, name, value) > } > Object createNode(Object name, Map map, Object value){ > println "Create node $name: $map, value $value" > new Node(null, name, map, value) > } > void setParent(Object parent, Object child){ > println "set parent of $child to $parent" > ((Node)parent).append( (Node) child) > } > } > def builder = new TestBuilder() > // First case > // expected: MissingMethodException tring to call String.foo() > // actual: MissingMethodException tring to call b(Closure) > try { > builder.a { > b { > error('xy'.foo()) > } > } > }catch (e){ > assert e instanceof MissingMethodException > assert e.method == "foo" > } > // Second case > // expected: one call to buidler.createNode('b') > // actual: two calls to buidler.createNode('b') > builder.with { > a { > b { > error("xy".foo()) > } > } > } > {code} -- This message was sent by Atlassian JIRA (v6.3.4#6332)