RFR: 8027682: javac wrongly accepts semicolons in package and import decls

Vicente Romero vromero at openjdk.org
Tue Feb 7 04:18:42 UTC 2023


On Mon, 6 Feb 2023 21:30:35 GMT, Archie L. Cobbs <duke at openjdk.org> wrote:

>>> Thanks for the comments.
>>> 
>>> Agree that smarter error checking for the likely scenario of a spurious semi-colon would be an improvement.
>>> 
>>> I'm agnostic on what would be "best" - just trying to address some stale bugs.
>>> 
>>> If there is uncertainty about what the spec should be, but also no action, that obviously paralyzes progress. What do you guys recommend we do?
>>> 
>>> This bug will have its 10th birthday in October :)
>> 
>> I would suggest to go ahead with a solution to report and ignore excess semicolons, since changing JLS is a bigger deal that cannot be done here.   And even if we change JLS going forward, a solution to "report and ignore" excess semicolons might be worth back-porting.
>
>> I would suggest to go ahead with a solution to report and ignore excess semicolons, since changing JLS is a bigger deal that cannot be done here. And even if we change JLS going forward, a solution to "report and ignore" excess semicolons might be worth back-porting.
> 
> Sounds like a good plan - thanks!

@archiecobbs we use JavacParser::peekToken to look ahead, this method could be useful here

-------------

PR: https://git.openjdk.org/jdk/pull/12448


More information about the compiler-dev mailing list