Empty value type ?

Brian Goetz brian.goetz at oracle.com
Tue Jun 26 19:43:24 UTC 2018


Zero-length values can be quite useful, just not directly.  Look at the current implementations of Set that delegate to HashMap; all that wasted space.  When we have specialized generics, they can specialize to HashMap<T, empty>, and that space gets squeezed away to zero.  

> On Jun 26, 2018, at 11:36 AM, Kirk Pepperdine <kirk.pepperdine at gmail.com> wrote:
> 
> How can a value type be empty.. what is an empty integer? An empty string? Just curious.
> 
> Kind regards,
> Kirk
> 
> 
> 
>> On Jun 26, 2018, at 3:28 PM, forax at univ-mlv.fr wrote:
>> 
>> ok,
>> in that case, i think zero field value types should be rejected by the compiler.
>> 
>> Rémi
>> 
>> ----- Mail original -----
>>> De: "Tobias Hartmann" <tobias.hartmann at oracle.com>
>>> À: "Remi Forax" <forax at univ-mlv.fr>, "valhalla-dev" <valhalla-dev at openjdk.java.net>
>>> Envoyé: Mardi 26 Juin 2018 15:23:46
>>> Objet: Re: Empty value type ?
>> 
>>> Hi Remi,
>>> 
>>> no, empty value types are not planned to be supported for LW1.
>>> 
>>> Best regards,
>>> Tobias
>>> 
>>> On 26.06.2018 15:19, Remi Forax wrote:
>>>> Is empty value type targeted for LW1 ?
>>>> 
>>>> Error: LinkageError occurred while loading main class GenBug
>>>> 	java.lang.ClassFormatError: class: GenBug - Value Types do not support zero
>>>> 	instance size yet
>>>> 
>>>> Rémi
> 




More information about the valhalla-dev mailing list