On 3/30/2021 6:29 AM, Roger Riggs wrote:
On Wed, 24 Mar 2021 23:17:46 GMT, Joe Darcy <da...@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`


I think the use of the new instanceof form would be better left for a follow-up refactoring.

Thanks,

-Joe

Reply via email to