grammars-v4
grammars-v4 copied to clipboard
Java 20 grammar bug(?) in localVariableDeclaration
In Java20Parser.g4's localVariableDeclaration rule (line 887), variableDeclaratorList is optional. The rule is based on Paragraph 14.4 of the Java 20 language specification, which does not specify variableDeclaratorList as optional.
Due to this,
class Foo { void bar () { boolean; } }
successfully parses, although it violates the specification as a variableDeclaratorList is expected after the typeIdentifier (boolean).