< prev index next >

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

Print this page
*** 1651,10 ***
--- 1651,16 ---
  
          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 if it's a primitive class
+             if (receiver != null && receiver.isPrimitiveClass()) {
+                 receiver = receiver.asValueType();
+             }
              switch (this) {
                  case GET:
                      ps = allocateParameters(0, receiver, intermediate);
                      fillParameters(ps, receiver, intermediate);
                      return MethodType.methodType(value, ps);
< prev index next >