ARM and repeating exceptions

Aleksey Shipilev aleksey.shipilev at gmail.com
Tue May 22 22:41:39 PDT 2012


Hi Joe,

On Wed, May 23, 2012 at 3:41 AM, Joseph Darcy <joe.darcy at oracle.com> wrote:
> The semantics of the try-with-resources statement are defined in the Java
> Language Specification:

I have failed to see where in the spec you can find this:

>  One exception should be at most the cause of XOR suppressed by another.

The wording and spirit of Throwable.addSuppressed API argues it should
be used when you have *another* exception and only one needs to be
propagated. In the test case like mine you can *single* exception that
needs to be propagated, so there is no reason to suppress any other
exceptions.

That said, imposing that additional requirement without even
mentioning this in spec violates the "principle of least
astonishment".


-Aleksey.



More information about the compiler-dev mailing list