Bug 40704 - Wrong error message for variables instantiated inside an if statement
Summary: Wrong error message for variables instantiated inside an if statement
Status: CLOSED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1.1   Edit
Hardware: PC Windows 2000
: P3 minor (vote)
Target Milestone: 3.0 M9   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2003-07-24 06:42 EDT by Eric Bodden CLA
Modified: 2009-08-30 02:08 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Bodden CLA 2003-07-24 06:42:16 EDT
Example code:

	public TestResultSet foo(int a) {
		if(a<CONSTANT)
			TestResultSet result = new TestResultSet(1);
		else
			TestResultSet result = new TestResultSet(2);
			                                         
		return result;
	}

This code givs me a syntax error in the third line on the word "result" telling 
me that on of "==","<="... was expected. But the actual error is that result is 
declared inside the if statment.

If I use brackets...

	public TestResultSet foo(int a) {
		if(a<CONSTANT) {
			TestResultSet result = new TestResultSet(1);
		} else {
			TestResultSet result = new TestResultSet(2);
		}	                                         
		return result;
	}

... the error message is fine.

Email me for the whole code if necessary. Cheers.
Comment 1 Philipe Mulet CLA 2003-07-24 11:42:38 EDT
Which build are you using ?

Also, please attach entire test case since the offending message is likely very 
contextual.
Comment 2 Eric Bodden CLA 2003-07-25 05:14:23 EDT
Unfortunately I cannot provide the exact example code because it is IBM 
confidential. However I am using revision 200306271545.
Comment 3 David Audel CLA 2003-10-02 11:05:07 EDT
I cannot reproduce the problem without a complete test case.

If you can give me a test case, reopen the bug.
Comment 4 Philipe Mulet CLA 2004-04-08 09:42:52 EDT
Timed out
Comment 5 Denis Roy CLA 2009-08-30 02:08:42 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.