RFR: 8366028: MethodType::fromMethodDescriptorString should not throw UnsupportedOperationException for invalid descriptors
Chen Liang
liach at openjdk.org
Sat Aug 23 01:53:19 UTC 2025
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`.
-------------
Commit messages:
- Add bug number
- 8366028: MethodType::fromMethodDescriptorString should not throw UnsupportedOperationException for invalid descriptors
Changes: https://git.openjdk.org/jdk/pull/26909/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=26909&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8366028
Stats: 31 lines in 2 files changed: 27 ins; 0 del; 4 mod
Patch: https://git.openjdk.org/jdk/pull/26909.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/26909/head:pull/26909
PR: https://git.openjdk.org/jdk/pull/26909
More information about the core-libs-dev
mailing list