The explicit cast to primitive does not result in boxing/unboxing. It
is the "magic" of PolymorphicSignature which actually adjusts to allow
for primitives.

On Mon, May 10, 2021 at 11:08 AM Erik Svensson <erik.svens...@nasdaq.com> wrote:
>
>
> On 2021-05-10, 18:03, "Brett Okken" <brett.okken...@gmail.com> wrote:
>
>     WARNING - External email; exercise caution.
>
>     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.
>
> But there is an explicit cast, I thought that was the unboxing?
>
>     [1] - 
> https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/invoke/MethodHandle.html
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
>     For additional commands, e-mail: dev-h...@commons.apache.org
>
>
> *******************************************
> CONFIDENTIALITY AND PRIVACY NOTICE: This e-mail and any attachments are for 
> the exclusive and confidential use of the intended recipient and may 
> constitute non-public information.  Personal data in this email is governed 
> by our Privacy Policy at  https://www.nasdaq.com/privacy-statement  unless 
> explicitly excluded from it; please see the section in the policy entitled 
> “Situations Where This Privacy Policy Does Not Apply” for circumstances where 
> different privacy terms govern emailed personal data.  If you received this 
> e-mail in error, disclosing, copying, distributing or taking any action in 
> reliance of this e-mail is strictly prohibited and may be unlawful. Instead, 
> please notify us immediately by return e-mail and promptly delete this 
> message and its attachments from your computer system. We do not waive any 
> work product or other applicable legal privilege(s) by the transmission of 
> this message.
> *******************************************
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to