RFR: 8304929: MethodTypeDesc throws an unchecked exception than ReflectiveOperationException when a component class cannot be resolved

Jorn Vernee jvernee at openjdk.org
Wed Jul 3 13:44:19 UTC 2024


On Tue, 2 Jul 2024 16:20:54 GMT, Chen Liang <liach 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.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/19991#discussion_r1664215860


More information about the core-libs-dev mailing list