< prev index next >

src/java.base/share/classes/java/lang/invoke/VarHandle.java

Print this page

        

@@ -1542,10 +1542,15 @@
 
         MethodType accessModeType(Class<?> receiver, Class<?> value,
                                   Class<?>... intermediate) {
             Class<?>[] ps;
             int i;
+            // the field type (value) is mapped to the return type of MethodType
+            // the receiver type is mapped to a parameter type of MethodType
+            // So use the value type as receiver may be a box type.
+            if (receiver != null && receiver.isValue())
+                receiver = receiver.asValueType();
             switch (this) {
                 case GET:
                     ps = allocateParameters(0, receiver, intermediate);
                     fillParameters(ps, receiver, intermediate);
                     return MethodType.methodType(value, ps);
< prev index next >