# Thursday, July 25, 2002
« No Title | Main | No Title »
More java.lang.Throwable

I did some more work on Throwable. In my previous post I forgot to mention that virtual methods in Throwable wheren't overidable yet (because they have no equivalent in System.Exception, I cannot reuse those vtable slots, like I do for System.Object). I implemented a mechanism to support those now. Every direct subclass of Throwable is converted into a .NET subtype of System.Exception and it implements the Throwable$VirtualMethods interface. Each virtual invocation of a virtual method in Throwable is redirected to a static method in the class Throwable$VirtualMethodsHelper that checks if the type implements the Throwable$VirtualMethods interface, if it does, the method is routed there, if it doesn't the method is routed to the C# implementation of the Throwable method in ExceptionHelper.

BTW, the reason that the static helper methods are in a separate class, is because Reflection.Emit (incorrectly) doesn't allow the definition of static methods in interfaces.

The cool part of all this is that all of this virtual method handling is generic and completely based on the remappings defined in map.xml.

I also implemented the 1.4 stack trace handling, so Throwable is now fully functional.

BTW#2, there is also an alternative way I could have handled the virtual methods, by making Throwable a subtype of System.Exception. I haven't figured out the pros and cons of this, so may be I'll do the alternative implementation in a few days to see if that is a more elegant way of doing it.

Updated the snapshot.

Thursday, July 25, 2002 6:16:31 PM (W. Europe Daylight Time, UTC+02:00)  #    Comments [1]