Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java 20 grammar bug(?) in localVariableDeclaration #4391

Open
ZekReshi opened this issue Jan 23, 2025 · 0 comments
Open

Java 20 grammar bug(?) in localVariableDeclaration #4391

ZekReshi opened this issue Jan 23, 2025 · 0 comments

Comments

@ZekReshi
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant