mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 07:14:30 +02:00
8254354: Add a withInvokeExactBehavior() VarHandle combinator
Reviewed-by: psandoz, chegar
This commit is contained in:
parent
d6f1463cb3
commit
0a41ca6b75
12 changed files with 1660 additions and 459 deletions
|
@ -27,6 +27,7 @@ package java.lang.invoke;
|
|||
|
||||
import jdk.internal.vm.annotation.DontInline;
|
||||
import jdk.internal.vm.annotation.ForceInline;
|
||||
import jdk.internal.vm.annotation.Hidden;
|
||||
import jdk.internal.vm.annotation.Stable;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
|
@ -463,7 +464,12 @@ class Invokers {
|
|||
|
||||
@ForceInline
|
||||
/*non-public*/
|
||||
@Hidden
|
||||
static MethodHandle checkVarHandleGenericType(VarHandle handle, VarHandle.AccessDescriptor ad) {
|
||||
if (handle.hasInvokeExactBehavior() && handle.accessModeType(ad.type) != ad.symbolicMethodTypeExact) {
|
||||
throw new WrongMethodTypeException("expected " + handle.accessModeType(ad.type) + " but found "
|
||||
+ ad.symbolicMethodTypeExact);
|
||||
}
|
||||
// Test for exact match on invoker types
|
||||
// TODO match with erased types and add cast of return value to lambda form
|
||||
MethodHandle mh = handle.getMethodHandle(ad.mode);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue