Bug 3249 - Error message is confusing: using token instead of identifier (1GCTDYM)
Summary: Error message is confusing: using token instead of identifier (1GCTDYM)
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All Windows 2000
: P4 normal (vote)
Target Milestone: 2.0 M1   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-10 22:51 EDT by Nick Edgar CLA
Modified: 2002-01-11 09:22 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Edgar CLA 2001-10-10 22:51:59 EDT
I was entered the following method.

public void goto(Frame frame) {
}

The compiler gave me an error for "goto":
Syntax error on token "Invalid Character", "Identifier" expected

Presumably this is because "goto" is a keyword.

The error message is very confusing, though.
I would expect something like:
Syntax error on keyword "goto"; Identifier expected instead

It didn't help that the Java text editor doesn't colour "goto" as a keyword.
See 1GCTE5I: ITPJUI:WIN2000 - Java text editor: "goto" is a keyword

NOTES:

AK (4/27/01 11:05:26 AM)
	duplicate of 1G83ZKL: ITPJUI:WINNT - unclear error message for a reserved word used as an identifier
Comment 1 Philipe Mulet CLA 2001-10-12 07:34:01 EDT
Would be interesting to see if we can improve a few error messages in the 
parser by substitutions.
Comment 2 Olivier Thomann CLA 2001-10-12 12:05:58 EDT
What do you mean by "by substitutions"?
Comment 3 Philipe Mulet CLA 2001-10-12 13:40:37 EDT
Something similar to what we do for unary expressions.
Comment 4 DJ Houghton CLA 2001-10-23 23:52:53 EDT
PRODUCT VERSION:
0.047

Comment 5 Olivier Thomann CLA 2001-10-30 15:04:34 EST
Fixed and released in HEAD. Some tests had to be updated as well. They relied on 
the old parse error message even if the token on which the error occured was a 
keyword.
These tests are test035, test173 and test174 in the NegativeTest suite.