RFR: 8254354: Add an asExact() VarHandle combinator [v2]

Rémi Forax github.com+828220+forax at openjdk.java.net
Fri Oct 23 18:06:52 UTC 2020


On Fri, 23 Oct 2020 18:04:11 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> Hi,
>> 
>> This patch adds an asExact() combinator to VarHandle, that will return a new VarHandle that performs exact type checks, similar to MethodHandle::invokeExact, to help developers catch inexact VarHandle usage, which can lead to performance degradation.
>> 
>> This is implemented using a boolean flag in VarForm. If the flag is set, the exact type of the invocation is checked against the exact type in the VarForm. If there is a mismatch, a WrongMethodTypeException is thrown.
>> 
>> Thanks,
>> Jorn
>
> Jorn Vernee has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Make internalName helper method static

src/java.base/share/classes/java/lang/invoke/MemoryAccessVarHandleGenerator.java line 450:

> 448:     }
> 449: 
> 450:     private String internalName(Class<?> cls) {

should be static, no ?

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

PR: https://git.openjdk.java.net/jdk/pull/843


More information about the core-libs-dev mailing list