Bug 27298 - Must return result error could be more accurate
Summary: Must return result error could be more accurate
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.1 M5   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 29343 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-11-28 07:28 EST by Jerome Lanneluc CLA
Modified: 2003-03-10 14:35 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 Jerome Lanneluc CLA 2002-11-28 07:28:39 EST
Build 20021127

In the following cu, a 'method must return a result of type int' error is 
reported against the whole if statement. It should really report it against 
the 'System.out.println()' statement.

public class X {
	public int foo() {
		if (System.out != null) {
			System.out.println();
		} else {
			return 1;
		}
	}
}
Comment 1 Philipe Mulet CLA 2002-11-28 08:32:14 EST
Alternatively, it could simply report this against the method, like we do for 
unassigned blank fields.
Comment 2 Philipe Mulet CLA 2003-01-08 07:04:39 EST
No more complaining against last statement if any. The method is simply blamed 
(like we did if it had no statement).

Fixed
Comment 3 Philipe Mulet CLA 2003-01-13 04:23:33 EST
*** Bug 29343 has been marked as a duplicate of this bug. ***
Comment 4 Bob Foster CLA 2003-01-13 09:09:52 EST
Still visually confusing. The method signature is not in error. Flagging the
closing right brace nearest to the problem would be less confusing and way less
obtrusive.
Comment 5 David Audel CLA 2003-02-07 09:37:22 EST
Verified.
Comment 6 Bob Foster CLA 2003-03-10 00:32:39 EST
Now that I see the result in RC2, I realize that I was wrong but so is the
current "fix". Obviously, it is the return type that should be highlighted.
Comment 7 Jerome Lanneluc CLA 2003-03-10 07:51:13 EST
I don't agree on this. The method has a problem, not the return type.
Comment 8 Bob Foster CLA 2003-03-10 14:35:34 EST
The problem in the method is it does not respect the return type.