Try/Catch DU Exception

Archie Cobbs archie.cobbs at gmail.com
Sun Jul 14 17:41:57 UTC 2024


On Sun, Jul 14, 2024 at 6:52 AM Attila Kelemen <attila.kelemen85 at gmail.com>
wrote:

> I think it probably would be enough to say in those cases that `Error` or
> any of its subclasses.
>

I agree with that... it would be simpler to just say "an Error can be
thrown at any time".

Also, I don't see the point of distinguishing between checked and unchecked
> exceptions. Because technically it is possible for a method to throw any
> exception. So, as for method calls I would just say that a method call may
> throw any exception (maybe special casing autoboxing and string
> concatenation), and ignoring that possibility would be rather dangerous
> (especially for the DA case).
>

Actually this is not a problem. The worst that can happen is you end up
initializing the variable twice at runtime (once legitimately in the try
block, and once again in the catch block due to the unexpected exception).
This is not a problem - the JVM doesn't care.

-Archie

-- 
Archie L. Cobbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20240714/00d5c043/attachment.htm>


More information about the amber-dev mailing list