Bug 26266

Summary: java syntax error for missing ";" is reported as belonging to a different line
Product: [Eclipse Project] JDT Reporter: Yiannis Mavroukakis <jander>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: RESOLVED WONTFIX QA Contact:
Severity: minor    
Priority: P3    
Version: 2.1   
Target Milestone: 2.1 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Yiannis Mavroukakis CLA 2002-11-14 06:44:24 EST
I am not particulary sure if this is a bug so apologies if it is not and I 
have wasted your time.
Using Eclipse 2.0 Build 200210181211 and JDT 2.1.0. While compiling a file 
with a syntax error -missing semicolon- I get the following error.

java.lang.Error: Unresolved compilation problem: 
	Syntax error on token "data", ";" expected

However, the error is attributed to the next line of code not the one that is 
at fault.
==Code Snippet==
String storeStatement = new String("csv")
data.put("Poll Question 1");
==Code Snippet==

Obviously,when compiling from command line the error is reported properly:

WebServiceClient.java:37: ';' expected
           String storeStatement = new String("csv")

Thank you.
Comment 1 Olivier Thomann CLA 2002-11-14 08:22:34 EST
You have a syntax error, because "data" in encountered instead of ";". Therefore
we report properly (IMHO) the problem saying that "data" was found instead of ";".
You could have both statements on the same line or you can have several blank
lines before the semi-colon. It would still be valid code.
Comment 2 Yiannis Mavroukakis CLA 2002-11-14 08:30:08 EST
I see, however, since the problem originated from the lack of a semi-colon, 
would it not be easier to the untrained eye, to actually highlight the line 
that is the root of the problem, and report what was expected as normal? :)
Comment 3 Philipe Mulet CLA 2002-11-14 08:46:04 EST
We report an unexpected token at the offending token location.

Closing, we won't change this.
Comment 4 Philipe Mulet CLA 2002-11-14 08:46:44 EST
Closing