Perhaps it is an Intellij issue. The MethodHandle javadoc[1] has an
"Usage examples" section. One of the examples shows calling
List.size() (which returns an int):

> Object x, y; String s; int i;
> MethodType mt; MethodHandle mh;
> MethodHandles.Lookup lookup = MethodHandles.lookup();
> ...
> mt = MethodType.methodType(int.class);
> mh = lookup.findVirtual(java.util.List.class, "size", mt);
> i = (int) mh.invokeExact(java.util.Arrays.asList(1,2,3));
> // invokeExact(Ljava/util/List;)I
> assert(i == 3);

There is no boxing/unboxing going on here.

[1] - 
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/invoke/MethodHandle.html

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to