Bug 14313 - DCR: AST in methods with missing return type
Summary: DCR: AST in methods with missing return type
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M6   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-04-22 09:43 EDT by Martin Aeschlimann CLA
Modified: 2002-04-26 04:55 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 Martin Aeschlimann CLA 2002-04-22 09:43:38 EDT
20020418
For a method with error like
public foo() {
 return 0;
}
I would like to offer a correction to fix the return type.
Unfortunatly, for methods like foo, the whole body is skipped (no statements).
Would it be possible to be fault tolerant here?
Comment 1 Olivier Thomann CLA 2002-04-22 12:19:13 EDT
This is a risky change since it occurs in the MethodScope.createMethod() method. There is no 
binding created for such a method. This methods sets the flag ignoreFurtherInvestigation for 
the method declaration. Then its statements are not parsed.
Philippe - Do you think it is doable 
to change this behavior now?
Comment 2 Olivier Thomann CLA 2002-04-25 14:01:39 EDT
I made some changes and asked Kent to double check them. If they are approved, it will be released 
today. With these changes, we parse the method body which allows you to retrieve the type of the 
return statement. You will still have a error message in the messages' list of its compilation 
unit. This method (foo() in your example) won't be seen as defined in its class if used inside 
another class. This is consistent with the usage of a method which has an invalid return type.
Comment 3 Olivier Thomann CLA 2002-04-25 14:52:57 EDT
Changes released and verified by Kent.
Comment 4 Martin Aeschlimann CLA 2002-04-26 04:55:56 EDT
Cool. Thanks a lot!