RFR: 8264148: Update spec for exceptions retrofitted for exception chaining
Roger Riggs
rriggs at openjdk.java.net
Tue Mar 30 13:29:23 UTC 2021
On Wed, 24 Mar 2021 23:17:46 GMT, Joe Darcy <darcy at openjdk.org> wrote:
> 8264148: Update spec for exceptions retrofitted for exception chaining
I agree that the public field in WriteAbortedException could be remediated.
But it is also mostly harmless.
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMObjectFactory.java line 62:
> 60: catch (java.lang.reflect.InvocationTargetException ite) {
> 61: if (ite.getCause() instanceof RuntimeException) {
> 62: throw (RuntimeException)ite.getCause();
This might be a place to use the new instanceof pattern form:
`if (ite.getCause() instanceof RuntimeException rex)
throw rex.getCause();
`
src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/Utils.java line 293:
> 291: Throwable t = e.getCause();
> 292: if (t instanceof Exception) {
> 293: throw (Exception) t;
Ditto:
` if (t instanceof Exception ex) throw ex`
-------------
Marked as reviewed by rriggs (Reviewer).
PR: https://git.openjdk.java.net/jdk/pull/3182
More information about the compiler-dev
mailing list