Using enhanced switch in MethodHandleDesc

Chen Liang liangchenblue at gmail.com
Fri Aug 15 03:13:13 UTC 2025


Forwarding to the main list, forgot to reply all.

On Thu, Aug 14, 2025 at 10:12 PM Chen Liang <liangchenblue at gmail.com> wrote:

> Hello wenshao, I think this is a reasonable enhancement.
>
> In addition, you can review the switch in jdk.internal.constant as well. I
> find there is a traditional switch in ConstantUtils.skipOverFieldSignature
> that can be updated too.
>
> Since enhanced switch statements and expressions can handle
> exhaustive switch over enum without default branches, you can consider
> remove default branches so we will get compile errors reminding us to
> update when we add new method handle kinds.
>
> Regards,
> Chen
>
> On Thu, Aug 14, 2025 at 9:49 PM wenshao <shaojin.wensj at alibaba-inc.com>
> wrote:
>
>> In MethodHandleDesc, the ofField method uses enhanced switch, while the
>> of and ofMethod methods use traditional switch. The same class should have
>> a unified style.
>>
>> https://github.com/openjdk/jdk/pull/26769
>>
>> I have submitted a draft Pull Request and would appreciate some feedback.
>>
>> -
>> Shaojin Wen
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250814/6a86e1ed/attachment-0001.htm>


More information about the core-libs-dev mailing list