Community
Participate
Working Groups
I typed static final String[] mylist {}; This is missing an "=". The error I received said that the compiler was expecting a "{", ";", or ",".
The problem is related to the fact that the rule VariableDeclarator is already reduced when the syntax error is found. So the two possibles completions are what you can have when a variable is completed. Which means it can be followed by another variable (',') or it terminates the variable declarations (';'). I don't see how it is possible to change the parser in order not to reduce the actions when the syntax error is found. The syntax error is reported when all possible reductions have been done. In the grammar, one possible reduction occurs when the variable has no initialization. We know that the parser doesn't always return accurate error messages in case of syntax errors. I think we will have to live with it.
This problem is related to the parser technology we use. We won't change this now. So we should probably put somewhere in the release notes that the error messages on syntax errors are not always accurate.