Idea how to implement VT/VO compatibility in JVM

Vitaly Davidovich vitalyd at
Thu Jan 22 13:46:18 UTC 2015

Yes, but I'm not proposing to handle every value type (which is impossible
anyway since you don't know the set).  Instead, what would be nice is to
allow calling <any T> methods at runtime by providing the T parameter at
that point, after getting it via reflection.  This requires some form of
reification/VM support though.

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

> On 01/22/2015 02:34 PM, Vitaly Davidovich wrote:
>> Ok, so the issue is really reflection/late binding here and not <any T>
>> per say.  In .NET for example, there's reflection support for generics and
>> what one typically does in such a situation is invoke a generic method via
>> reflection by specifying the type parameter reflectively.  This all works
>> because generics are reified in the VM, of course.
>>  Well, yes and no: it's related to not being able to instantiate `any T`
> when you don't know `T` at compile-time. Currently you can handle every
> type in Java without having to know it by handling `Object` and every
> primitive. We can't expect people to handle every value type when it's an
> open-ended set, and there's no common superclass of value types, and
> they're not `Object` (unless they're autoboxed which doesn't happen when
> they're in containers like collections). So we can't handle them unless you
> can instantiate their type argument at compile-time. Using `any T` on
> methods only defers the problem but doesn't solve it for blind usages.

More information about the valhalla-dev mailing list