On 6/28/2022 10:38 AM, Brian Goetz wrote:
For the deconstruction pattern, i propose to throw a specific error
and to not wrap the subclasses of java.lang.Error thrown by the
deconstruction pattern.
The wrapper should not be an Error, but I see what you are getting at --
let Error through, wrap everything else. This would allow SOE and OOME
to manifest as expected -- and rely on the "well, know its a bad idea to
try and catch Error, but they are not as good about runtime
exceptions." Worth considering.
And of course this is already the policy for errors during bootstrap
method invocation:
-----JVMS 5.4.3.6-----
If the invocation fails by throwing an instance of Error or a subclass
of Error, resolution fails with that exception.
If the invocation fails by throwing an exception that is not an instance
of Error or a subclass of Error, resolution fails with a
BootstrapMethodError whose cause is the thrown exception.
----------------------
Alex