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 7B05B200D04 for ; Mon, 11 Sep 2017 15:50:57 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 79D2D1609C4; Mon, 11 Sep 2017 13:50:57 +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 BF9451609C3 for ; Mon, 11 Sep 2017 15:50:56 +0200 (CEST) Received: (qmail 12922 invoked by uid 500); 11 Sep 2017 13:50:56 -0000 Mailing-List: contact commits-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 commits@groovy.apache.org Received: (qmail 12912 invoked by uid 99); 11 Sep 2017 13:50:55 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 11 Sep 2017 13:50:55 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D281CF5566; Mon, 11 Sep 2017 13:50:55 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: paulk@apache.org To: commits@groovy.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: groovy git commit: Tweak how grammar detects non try-with-resource case with no catch/finally Date: Mon, 11 Sep 2017 13:50:55 +0000 (UTC) archived-at: Mon, 11 Sep 2017 13:50:57 -0000 Repository: groovy Updated Branches: refs/heads/master e0b787dcf -> da240387d Tweak how grammar detects non try-with-resource case with no catch/finally Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/da240387 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/da240387 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/da240387 Branch: refs/heads/master Commit: da240387d469395de955bcd18d3d667d04875113 Parents: e0b787d Author: paulk Authored: Mon Sep 11 23:42:02 2017 +1000 Committer: paulk Committed: Mon Sep 11 23:50:02 2017 +1000 ---------------------------------------------------------------------- src/main/antlr/GroovyParser.g4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/da240387/src/main/antlr/GroovyParser.g4 ---------------------------------------------------------------------- diff --git a/src/main/antlr/GroovyParser.g4 b/src/main/antlr/GroovyParser.g4 index d72b907..49877d7 100644 --- a/src/main/antlr/GroovyParser.g4 +++ b/src/main/antlr/GroovyParser.g4 @@ -663,8 +663,8 @@ locals[boolean resourcesExists = false] | nls finallyBlock | - // try-with-resources can have no catche and finally clauses - { $resourcesExists }? + // catch and finally clauses required unless it's a try-with-resources block + { require($resourcesExists, "either a catch or finally clause or both is required for a try-catch-finally statement", -5); } ) ;