Idea how to implement VT/VO compatibility in JVM

Vitaly Davidovich vitalyd at gmail.com
Thu Jan 22 14:30:23 UTC 2015


I don't quite get the elegance comment - there's already nothing elegant
about heavy use of reflection.  Yes, it gets the job done in some cases,
but it's a minority use case (I hope!).

Also, keep in mind that calling a Collection <?> taking method with value
type collections may not be safe as the code in that method may be relying
on Object semantics (e.g. locks on objects, compares reference identity,
etc); in some ways it's safer to call any T methods because presumably
person writing those is conscious of value types being a possibility and
also compiler may warn if any assumptions are made about it being an Object.

sent from my phone
On Jan 22, 2015 9:19 AM, "Stéphane Épardaud" <stef at epardaud.fr> wrote:

> On 01/22/2015 03:08 PM, Palo Marton wrote:
>
>> What Stephane probably needs is something like this:
>>
>> <I> I java.lang.reflect.Proxy.specializedToBoxed(Class<I> interface,
>> Object specialized_object);
>>
>>  Well, yes again this can be solved by reflection less elegantly. But
> note that if we have such a method, then we can provide autoboxing in
> public fields whose type includes `any T` which either solves _that_
> problem of my proposal, or at least means that both approaches will need to
> solve this issue.
>



More information about the valhalla-dev mailing list