Patch: RFA: Fix java/21045

Bryce McKinlay mckinlay@redhat.com
Thu Jul 7 02:28:00 GMT 2005


When an anonymous class is instantiated based on a constructor with a 
throws clause, we need to copy the throws clause of the 
super-constructor into the new synthetic constructor for the anonymous 
class. Currently GCJ does not do this, resulting in an error because a 
constructor's throws clause must normally match the constructor it is 
overriding.

In addition, it is legal to throw from an anonymous class initializer. 
Exceptions thrown from an anonymous class initializer need to be added 
to the initializer's throws clause.

One complication here is purge_unchecked_exceptions: 
java_complete_expand_method was saving the methods throws list, removing 
unchecked exceptions from it, and restoring the throws list later. This 
meant that exceptions could not be added to the throws list during 
expansion of the method. purge_unchecked_exceptions seems to be 
unneccessary, since exception checking code is already testing 
IS_UNCHECKED_EXCEPTION_P everywhere that it matters, as far as I can 
tell. So I have removed it. There is some further discussion of this 
here: http://gcc.gnu.org/ml/java/2001-08/msg00113.html

No testsuite regressions, and 4 new JACKS passes. OK to commit?

Bryce


-------------- next part --------------
A non-text attachment was scrubbed...
Name: java-PR21045.patch
Type: text/x-patch
Size: 9666 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20050707/0b586275/attachment.bin>


More information about the Gcc-patches mailing list