Integrated: 8366028: MethodType::fromMethodDescriptorString should not throw UnsupportedOperationException for invalid descriptors

Chen Liang liach at openjdk.org
Wed Aug 27 14:28:50 UTC 2025


On Sat, 23 Aug 2025 01:46:14 GMT, Chen Liang <liach at openjdk.org> wrote:

> A previous cleanup #14642 accidentally omitted the fact that an `Array.newInstance` call in `BytecodeDescriptor::parseSig` is intended to propagate `IllegalArgumentException` to `MethodType::fromMethodDescriptorString`. This bug is discovered in a recent cleanup for `BytecodeDescriptor` in #24978.
> 
> Instead of restoring the original `newInstance` call, this patch catches the `UnsupportedOperationException` thrown by `Class::arrayType` to because the cause IAE thrown by `newInstance` has no message at all. The existing reporting system in `BytecodeDescriptor::parseMethod` includes the whole malformed descriptor string in the error message, which can be triggered by returning `null` in `parseSig`.

This pull request has now been integrated.

Changeset: 1d53ac30
Author:    Chen Liang <liach at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/1d53ac30f1db88df9a97b63b3ff56d26975d3a57
Stats:     32 lines in 2 files changed: 28 ins; 0 del; 4 mod

8366028: MethodType::fromMethodDescriptorString should not throw UnsupportedOperationException for invalid descriptors

Reviewed-by: jvernee

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

PR: https://git.openjdk.org/jdk/pull/26909


More information about the core-libs-dev mailing list