RFR: 8304929: MethodTypeDesc throws an unchecked exception than ReflectiveOperationException when a component class cannot be resolved
Chen Liang
liach at openjdk.org
Wed Jul 3 14:16:19 UTC 2024
On Wed, 3 Jul 2024 13:41:29 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> Simple fix for `MethodTypeDescImpl`'s violation of `resolveConstantDesc` specification.
>
> src/java.base/share/classes/jdk/internal/constant/MethodTypeDescImpl.java line 228:
>
>> 226: mtype = mt;
>> 227: } catch (TypeNotPresentException ex) {
>> 228: throw (ClassNotFoundException) ex.getCause();
>
> On a side note, I wonder if it's better to re-wrap the exception here as a `ReflectiveOperationException`, instead of just getting the cause. That will retain the entire stack trace.
Fyi the exception was thrown at https://github.com/openjdk/jdk/blob/5a8af2b8b93672de9b3a3e73e6984506980da932/src/java.base/share/classes/sun/invoke/util/BytecodeDescriptor.java#L95.
I will make builds with both approaches, and see how their traces differ. I will stay on rethrow only if the original stacktrace is already informative enough.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/19991#discussion_r1664266161
More information about the core-libs-dev
mailing list