On Tue, 25 Nov 2025 03:38:41 GMT, Francesco Nigro <[email protected]> wrote:

>>> This has bitten me lot of times @liach 😢 Including others while 
>>> reading/writing oop fields into arrays too; it would be nice to get an 
>>> option to fail fast with an exception enabled via diagnostic args eg 
>>> EnableStrictPolymorphicSignature Although Javac should be able to detect it 
>>> too, thinking about it twice
>> 
>> This can be done using 
>> [`VarHandle::withInvokeExactBehavior`](https://docs.oracle.com/en/java/javase/24/docs/api/java.base/java/lang/invoke/VarHandle.html#withInvokeExactBehavior())
>>  on a per var handle basis. C2 can constant fold the type-check away as well.
>
> @JornVernee thanks 🙏 I admit it's the first time I see this method, wow

@franz1981 You can type "/integrate" into a comment and I will sponsor. I ran 
tests with the change yesterday and all good.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/28475#issuecomment-3574186718

Reply via email to