RFR: 8350607: Consolidate MethodHandles::zero into MethodHandles::constant [v2]
Claes Redestad
redestad at openjdk.org
Wed Mar 5 18:58:56 UTC 2025
On Tue, 25 Feb 2025 22:08:33 GMT, Chen Liang <liach at openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java line 2241:
>>
>>> 2239: var form = constantForm(basicType);
>>> 2240:
>>> 2241: if (type.isPrimitive()) {
>>
>> I think you could simplify this using `Wrapper.forBasicType`; all variants should be able to use `wrapper.convert`
>
> The cast is not performed if the `type` is an interface; this is a behavioral disparity with the old `value = ptype.cast(value);` in `insertArguments`.
Sure, we'd need an explicit `cast` in the `OBJECT` case and that would be a bit redundant. Might still amount to a code simplification.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23706#discussion_r1982027617
More information about the core-libs-dev
mailing list