[e-lang] Embed E in Java

Kevin Reid kpreid at mac.com
Tue Jan 12 18:55:46 PST 2010


On Oct 21, 2009, at 13:25, Mark Miller wrote:
> On Tue, Oct 20, 2009 at 9:17 AM, Kevin Reid <kpreid at mac.com> wrote:
>> MarkM: Is there a non-historical reason NestedException/
>> NestedThrowable/etc exist instead of using the Java 1.4
>> Throwable.getCause() mechanism?
>
> Mostly history. The NestedException,.. mechanism predates Java 1.4.
> Since it worked, I have never examined the new getCause() API. I do
> not know whether or not it would be safe to use instead.

[rest of thread omitted]

Here's my draft patch for this. Please review.

It makes the following changes:

* NestedException and NestedIOException now use the Throwable cause  
field to store the provided exception. (The constructor parameter  
order is backwards from the Java conventional one, but I decided not  
to make the effort to change that.)

* Deleted NestedError, as that class was not used.

* Renamed Nested* to EBacktrace*, reflecting the primary use of these  
classes since 'nesting' is now in general possible with plain Java  
throwables. (I'm not sure this is a good idea.)

* Enabled getCause() and initCause(throwable) in Throwable.safej. (I  
also noticed that printStackTrace() is enabled, but should not be, as  
it carries authority to stderr; I intend to fix this as a separate  
commit.)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nested-exception-renamed-and-uses-cause-20090112.patch
Type: application/octet-stream
Size: 58892 bytes
Desc: not available
Url : http://www.eros-os.org/pipermail/e-lang/attachments/20100112/227817e8/attachment-0001.obj 
-------------- next part --------------


-- 
Kevin Reid                                  <http://switchb.org/kpreid/>






More information about the e-lang mailing list