Proposal: Automatic Resource Management
jjb at google.com
Sat Mar 7 10:31:23 PST 2009
On Sat, Mar 7, 2009 at 10:21 AM, Neal Gafter <neal at gafter.com> wrote:
> On Sat, Mar 7, 2009 at 9:48 AM, Joshua Bloch <jjb at google.com> wrote:
> > Agreed. I like the solution in the "Additional Features" section of the
> > proposal entitled "Retaining suppressed exceptions." If there are no
> > compelling objections, I'll promote this to the body of the proposal in
> > next revision (and fill in the details).
> I don't see how that solves the problem. Are you suggesting that
> everywhere someone handles an exception they should also check for a
> chain of ignored exceptions and log them?
I am not suggesting this. Most people have no need to look at these
exceptions. Those who do can read them by calling the
getSuppressedExceptions()method. If people think it's worth it, the stack
trace printing code could be modified to include suppressed exceptions. In
many cases, that would cause suppressed exceptions to be logged
automatically. But I have some misgivings about this approach: I suspect
there are programs that parse stack traces. While I frown on this behavior,
and the spec does not guarantee that it works, I'd hate to be responsible
for breaking these programs.
What do others think of the "Retaining suppressed exceptions" feature?
Should it be promoted to the body of the proposal? Should the suppressed
exceptions be included in the stack trace?
More information about the coin-dev