Idea how to implement VT/VO compatibility in JVM

Vitaly Davidovich vitalyd at gmail.com
Thu Jan 22 13:41:18 UTC 2015


So this type of use case would be a problem if generics were there from day
1 but ? didn't exist.  What you want here is be able to invoke generic
methods at runtime /late bound, and not necessarily coercing everything to
extend ?.

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

> On 01/22/2015 02:26 PM, Maurizio Cimadamore wrote:
>
>>
>> In other words, Collection<?> means Collection<? extends Object>.
>> Therefore, primitives and values are outside the domain supported by the
>> unbounded wildcard.
>>
>> To fix that, you need to change 'm' as follows:
>>
>> <any T> void m2(Collection<T> c) { ... }
>>
>> m(ls); //ok
>> m(lo); //ok
>> m(li); //ok
>> m(lmpv); //ok
>>
>> Is this what you were asking?
>>
>
> Except you're again relying on compile-time available instantiations of
> `T`. Frameworks don't have those, they work by discovery as in my example.
>


More information about the valhalla-dev mailing list