There are two different bugs here, but I decided to include them in one issue/PR since the fix for both is quite simple and they are related.
Problem 1
In Java < 1.4, assert is not yet a keyword and can therefore be used as a regular identifier. There is an ambiguity in the grammar that causes a parse error when attempting to parse the statement:
The parser currently tries to parse this as an assert statement followed by a PREFIX_INCREMENT UnaryExpr. Parsing the UnaryExpr then fails since there is no expression following the ++.
Problem 2
module is a conditional keyword that can still be used as a package name. #4910 introduced a new grammar ambiguity causing a parse error when attempting to parse an import statement for a package starting with module:
The parser attempts to parse this as a module import import module .Foo and crashes when attempting to parse the name since a name cannot start with ..
There are two different bugs here, but I decided to include them in one issue/PR since the fix for both is quite simple and they are related.
Problem 1
In Java < 1.4,
assertis not yet a keyword and can therefore be used as a regular identifier. There is an ambiguity in the grammar that causes a parse error when attempting to parse the statement:assert++;The parser currently tries to parse this as an
assertstatement followed by aPREFIX_INCREMENTUnaryExpr. Parsing the UnaryExpr then fails since there is no expression following the++.Problem 2
moduleis a conditional keyword that can still be used as a package name. #4910 introduced a new grammar ambiguity causing a parse error when attempting to parse an import statement for a package starting withmodule:The parser attempts to parse this as a module import
import module .Fooand crashes when attempting to parse the name since a name cannot start with..