8304585: Method::invoke rewraps InvocationTargetException if a caller-sensitive method throws IAE

Reviewed-by: darcy, jpai, alanb
This commit is contained in:
Mandy Chung 2023-03-30 16:07:47 +00:00
parent 9df2060059
commit 1d7bb1ffa0
2 changed files with 86 additions and 6 deletions

View file

@ -174,12 +174,8 @@ class DirectMethodHandleAccessor extends MethodAccessorImpl {
// caller-sensitive method is invoked through a per-caller invoker while
// the target MH is always spreading the args
var invoker = JLIA.reflectiveInvoker(caller);
try {
// invoke the target method handle via an invoker
return invoker.invokeExact(target, obj, args);
} catch (IllegalArgumentException e) {
throw new InvocationTargetException(e);
}
// invoke the target method handle via an invoker
return invoker.invokeExact(target, obj, args);
}
}