@@ -143,9 +143,17 @@ memberDeclaration
143
143
| enumDeclaration
144
144
;
145
145
146
+ /* We use rule this even for void methods which cannot have [] after parameters.
147
+ This simplifies grammar and we can consider void to be a type, which
148
+ renders the [] matching as a context-sensitive issue or a semantic check
149
+ for invalid return type after parsing.
150
+ */
146
151
methodDeclaration
147
- : type Identifier methodDeclaratorRest
148
- | ' void' Identifier voidMethodDeclaratorRest
152
+ : (type|' void' ) Identifier formalParameters (' [' ' ]' )*
153
+ (' throws' qualifiedNameList)?
154
+ ( methodBody
155
+ | ' ;'
156
+ )
149
157
;
150
158
151
159
genericMethodDeclaration
@@ -189,6 +197,11 @@ interfaceMethodOrFieldRest
189
197
| interfaceMethodDeclaratorRest
190
198
;
191
199
200
+ /* * We use this even for void methods which cannot have [] after parameters.
201
+ This simplifies grammar and we can consider void to be a type, which
202
+ renders the [] matching as a context-sensitive issue or a semantic check
203
+ for invalid return type after parsing.
204
+ */
192
205
methodDeclaratorRest
193
206
: formalParameters (' [' ' ]' )*
194
207
(' throws' qualifiedNameList)?
@@ -197,13 +210,6 @@ methodDeclaratorRest
197
210
)
198
211
;
199
212
200
- voidMethodDeclaratorRest
201
- : formalParameters (' throws' qualifiedNameList)?
202
- ( methodBody
203
- | ' ;'
204
- )
205
- ;
206
-
207
213
interfaceMethodDeclaratorRest
208
214
: formalParameters (' [' ' ]' )* (' throws' qualifiedNameList)? ' ;'
209
215
;
0 commit comments