On Fri, 8 May 2026 17:52:19 GMT, Dan Smith <[email protected]> wrote:
>> @dansmithcode
>> I'm not sure I fully understand the question. The requested local is a value
>> `this` object. The API behavior is special in a case when two conditions are
>> `true`: (1) the frame belongs to a value object constructor (so the cltor's
>> class is a value class) and (2) the requested local is the `THIS` object
>> from the slot 0. It is per our previous discussion on the `project-jep401`
>> slack channel: We do not want mutable JNI reference to a value object to
>> escape while it is under construction, so we return a JNI reference to a
>> snapshot of the 'THIS' object.
>
> An abstract value class can have identity and value subclasses.
>
>
> abstract value class Number { ... }
> value class Integer extends Number { ... }
> class BigInteger extends Number { ... }
>
>
> I'm asking what happens when you try to get `this` from a constructor of
> `Number`: do you check whether `this` is a value object (an Integer, not a
> BigInteger), or do you apply the special-case logic to _all_ values of
> `this`, whether they are Integers or BigIntegers?
(I'm guessing a "snapshot" is an operation that only makes sense for value
objects, so you would not do it for the BigInteger. But I'm not sure.)
-------------
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2412#discussion_r3210446595