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 89438200C8C for ; Tue, 2 May 2017 04:09:13 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 880BC160BC2; Tue, 2 May 2017 02:09:13 +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 BBA26160BC8 for ; Tue, 2 May 2017 04:09:12 +0200 (CEST) Received: (qmail 7990 invoked by uid 500); 2 May 2017 02:09:12 -0000 Mailing-List: contact notifications-help@groovy.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@groovy.apache.org Delivered-To: mailing list notifications@groovy.apache.org Received: (qmail 7930 invoked by uid 99); 2 May 2017 02:09:11 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 02 May 2017 02:09:11 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id F22D5CC7F3 for ; Tue, 2 May 2017 02:09:10 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id fpghXCL1wDDJ for ; Tue, 2 May 2017 02:09:10 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 93D3B60D0A for ; Tue, 2 May 2017 02:09:09 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id AA316E0D85 for ; Tue, 2 May 2017 02:09:08 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 5D89421E2B for ; Tue, 2 May 2017 02:09:07 +0000 (UTC) Date: Tue, 2 May 2017 02:09:07 +0000 (UTC) From: "Paul King (JIRA)" To: notifications@groovy.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Reopened] (GROOVY-6336) Support Java 7 ARM blocks MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Tue, 02 May 2017 02:09:13 -0000 [ https://issues.apache.org/jira/browse/GROOVY-6336?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul King reopened GROOVY-6336: ------------------------------- > Support Java 7 ARM blocks > ------------------------- > > Key: GROOVY-6336 > URL: https://issues.apache.org/jira/browse/GROOVY-6336 > Project: Groovy > Issue Type: New Feature > Components: Compiler > Affects Versions: 2.2.0-beta-2 > Reporter: Tom Dunstan > Assignee: Daniel Sun > Fix For: 3.0 > > > Currently Groovy does not have an equivalent to Java 7's ARM blocks. The closest is adding a method which takes a closure to the class that you'd like to be auto-closed (or whatever gives you that resource), and implementing the closing logic in that method. This has a host of problems: > - It's inefficient, requiring multiple method calls and an extra closure class over the Java solution > - Since the closure-accepting methods are added ad-hoc, they have different names and quite possibly subtly different behaviour, particularly around what happens if an exception is thrown during the closing. By contrast this is well defined in Java 7 so a programmer doesn't have to go hunting for documentation or source code on the method that they're calling > - If you are trying to work with an existing Java library rather than Groovy code, you're out of luck, since short of metaclass hacking you won't be able to add a wrapper method anyway > It would also be nice to keep Groovy and Java syntax as consistent as possible to ease porting between the two. -- This message was sent by Atlassian JIRA (v6.3.15#6346)