On Fri, 27 Mar 2026 13:35:19 GMT, Stefan Karlsson <[email protected]> wrote:
>> What is your concern?
>
> My concern is that I don't fully understand why the code the way it does, and
> it looks a little bit funny.
>
> For example:
>
> Object[] array = (Object[]) handle.arrayType.cast(oarray);
> Class<?> arrayType = oarray.getClass();
> if (ValueClass.isFlatArray(array)) {
>
>
> It performs a cast to get an `array` reference, but then it uses the `oarray`
> reference to fetch the `arrayType` (and the same for the isFlatArray call
> that I'm changing).
>
> I would think that the could look like this:
>
> Object[] array = (Object[]) handle.arrayType.cast(oarray);
> Class<?> arrayType = array.getClass();
> if (ValueClass.isFlatArray(array)) {
>
> but I'm not sure if that is missing some very subtle detail that is important
> for the code.
I don't think there's any semantic difference between the two version, but the
new version is more natural when reading the code.
-------------
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2261#discussion_r3022265551