[1/3] groovy git commit: Tweak how grammar detects non try-with-resource case with no catch/finally

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[1/3] groovy git commit: Tweak how grammar detects non try-with-resource case with no catch/finally

Daniel.Sun
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 <[hidden email]>
Authored: Mon Sep 11 21:42:02 2017 +0800
Committer: sunlan <[hidden email]>
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); }
         )
     ;
 

Reply | Threaded
Open this post in threaded view
|

[2/3] groovy git commit: Add guard checking for `getGroovydoc`

Daniel.Sun
Add guard checking for `getGroovydoc`

(cherry picked from commit a2fb76d)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/6007654a
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/6007654a
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/6007654a

Branch: refs/heads/GROOVY_2_6_X
Commit: 6007654ad59cec1cdb40925adb477c6a912c4360
Parents: bd8e7e7
Author: sunlan <[hidden email]>
Authored: Mon Sep 11 21:53:07 2017 +0800
Committer: sunlan <[hidden email]>
Committed: Mon Sep 11 22:28:52 2017 +0800

----------------------------------------------------------------------
 src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/6007654a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index 1b8e803..f9e7bb6 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -18891,6 +18891,10 @@ public class DefaultGroovyMethods extends DefaultGroovyMethodsSupport {
      * @since 2.6.0
      */
     public static groovy.lang.groovydoc.Groovydoc getGroovydoc(AnnotatedElement holder) {
-        return new groovy.lang.groovydoc.Groovydoc(holder.<Groovydoc>getAnnotation(Groovydoc.class).value(), holder);
+        Groovydoc groovydocAnnotation = holder.<Groovydoc>getAnnotation(Groovydoc.class);
+
+        return null == groovydocAnnotation
+                    ? null
+                    : new groovy.lang.groovydoc.Groovydoc(groovydocAnnotation.value(), holder);
     }
 }

Reply | Threaded
Open this post in threaded view
|

[3/3] groovy git commit: Fix the position issue

Daniel.Sun
In reply to this post by Daniel.Sun
Fix the position issue

(cherry picked from commit 58bc7a8)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/699627e1
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/699627e1
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/699627e1

Branch: refs/heads/GROOVY_2_6_X
Commit: 699627e17946603bb13f8101d31c40f9af75c101
Parents: 6007654
Author: sunlan <[hidden email]>
Authored: Mon Sep 11 22:25:22 2017 +0800
Committer: sunlan <[hidden email]>
Committed: Mon Sep 11 22:29:00 2017 +0800

----------------------------------------------------------------------
 src/main/antlr/GroovyParser.g4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/699627e1/src/main/antlr/GroovyParser.g4
----------------------------------------------------------------------
diff --git a/src/main/antlr/GroovyParser.g4 b/src/main/antlr/GroovyParser.g4
index a3d8869..a03da00 100644
--- a/src/main/antlr/GroovyParser.g4
+++ b/src/main/antlr/GroovyParser.g4
@@ -697,7 +697,7 @@ locals[boolean resourcesExists = false]
             nls finallyBlock
         |
             // 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); }
+            { require($resourcesExists, "either a catch or finally clause or both is required for a try-catch-finally statement"); }
         )
     ;