Community
Participate
Working Groups
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?
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?
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.
Changes released and verified by Kent.
Cool. Thanks a lot!