Repository: groovy Updated Branches: refs/heads/GROOVY_2_6_X 00768041b -> 699627e17
Tweak how grammar detects non try-with-resource case with no catch/finally (cherry picked from commit da24038) Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/bd8e7e72 Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/bd8e7e72 Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/bd8e7e72 Branch: refs/heads/GROOVY_2_6_X Commit: bd8e7e72cab112eea56e15aec8fe48a86f907ba5 Parents: 0076804 Author: paulk <pa...@asert.com.au> Authored: Mon Sep 11 21:42:02 2017 +0800 Committer: sunlan <sun...@apache.org> Committed: Mon Sep 11 22:28:43 2017 +0800 ---------------------------------------------------------------------- src/main/antlr/GroovyParser.g4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/bd8e7e72/src/main/antlr/GroovyParser.g4 ---------------------------------------------------------------------- diff --git a/src/main/antlr/GroovyParser.g4 b/src/main/antlr/GroovyParser.g4 index 59ac4f9..a3d8869 100644 --- a/src/main/antlr/GroovyParser.g4 +++ b/src/main/antlr/GroovyParser.g4 @@ -696,8 +696,8 @@ locals[boolean resourcesExists = false] | nls finallyBlock | - // try-with-resources can have no catche and finally clauses - { $resourcesExists }?<fail={"catch or finally clauses are required for try-catch statement"}> + // 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); } ) ;