EnumSet and reification
Remi Forax
forax at univ-mlv.fr
Sat Oct 5 11:15:52 UTC 2013
On 10/05/2013 04:30 AM, cowwoc wrote:
> Hi,
>
> Out of curiosity, is JDK 8's type reification improved enough so
> that we can replace
>
> <E extends Enum<E>> EnumSet<E> EnumSet.noneOf(Class<E>)
>
> with
>
> <E extends Enum<E>> EnumSet<E> EnumSet.noneOf()
>
> and the JDK will figure out the value of E based on the expected
> return type? If so, can we make this API change?
>
> Thanks,
> Gili
No, generics are not reified in Java 8 ... but lambda are reified, at
least a kind of.
You can not access to the type argument but the reified signature of the
lambda need to be known at runtime, this is a side effect of the fact
that lambda proxies are generated at runtime.
Rémi
More information about the core-libs-dev
mailing list