Static fields and specialization
Brian Goetz
brian.goetz at oracle.com
Sat Jan 10 22:18:08 UTC 2015
I think his question was: how will we maintain the optimization where
Optional.empty() returns a statically-allocated, shared singleton
instance when the value being returned is type-specific.
On 1/10/2015 5:08 PM, Ben Lewis wrote:
> Static fields cannot be specialized as what type would the field be
> Optional, Optional<int> or Optional<someValueType>. This approach has
> problems with generics anyways, both Optional.empty() and
> Collections.empty*() are methods to maintain type safety as stated in the
> javadocs.
>
> On Sun, Jan 11, 2015 at 10:34 AM, Palo Marton <palo.marton at gmail.com> wrote:
>
>> If static fields are not specialized, how will you handle things
>> like Optional.EMPTY?
>>
More information about the valhalla-dev
mailing list