Bug 5432

Summary: compiler syntax error is incorrect
Product: [Eclipse Project] JDT Reporter: Dave Dykstal <Dave_Dykstal>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED WONTFIX QA Contact:
Severity: minor    
Priority: P4    
Version: 1.0   
Target Milestone: 2.0 M1   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Dave Dykstal CLA 2001-11-01 15:13:37 EST
I typed

static final String[] mylist {};

This is missing an "=".  The error I received said that the compiler
was expecting a "{", ";", or ",".
Comment 1 Olivier Thomann CLA 2001-12-11 14:13:52 EST
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.
Comment 2 Olivier Thomann CLA 2001-12-12 12:40:48 EST
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.