Bug 14313

Summary: DCR: AST in methods with missing return type
Product: [Eclipse Project] JDT Reporter: Martin Aeschlimann <martinae>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0 M6   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

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!