grammars-v4 icon indicating copy to clipboard operation
grammars-v4 copied to clipboard

Java 20 grammar bug(?) in localVariableDeclaration

Open ZekReshi opened this issue 9 months ago • 0 comments

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).

ZekReshi avatar Jan 23 '25 14:01 ZekReshi