This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/master by this push:
     new 0b85e3000e Fix antlr4 warning for rule `methodDeclaration`
0b85e3000e is described below

commit 0b85e3000e7cc83083b55121f9743b7ce3ff779a
Author: Daniel Sun <[email protected]>
AuthorDate: Sat Mar 28 12:08:08 2026 +0900

    Fix antlr4 warning for rule `methodDeclaration`
    
    warning(154): GroovyParser.g4:283:0: rule 'methodDeclaration' contains an 
optional block with at least one alternative that can match an empty string
---
 src/antlr/GroovyParser.g4 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/antlr/GroovyParser.g4 b/src/antlr/GroovyParser.g4
index 67da533f72..550852286a 100644
--- a/src/antlr/GroovyParser.g4
+++ b/src/antlr/GroovyParser.g4
@@ -286,8 +286,9 @@ methodDeclaration[int t, int ct]
         (   { $ct == 3 }? // GROOVY-11208: @interface only
             (DEFAULT nls elementValue)
         |
-            (nls THROWS nls qualifiedClassNameList)?
-            (nls methodBody)?
+            nls THROWS nls qualifiedClassNameList (nls methodBody)?
+        |
+            nls methodBody
         )?
     ;
 

Reply via email to