JVMS draft for L-world value types with support for nullability
paul.sandoz at oracle.com
Wed Feb 7 16:37:57 UTC 2018
> On Feb 7, 2018, at 6:35 AM, Karen Kinnear <karen.kinnear at oracle.com> wrote:
> Just to make sure we are in sync for now:
> I think we are all in agreement that current Enums can not migrate to be
> value types:
> 1. enums have identity
> 2. enums have java.lang.Enum abstract class as super-class, not java.lang.Object
> 3. there is no clear default value
> 4. enums have mutable fields.
> What I think you are wondering about is if there is a role for a new kind of type,
> value-enums, that have value type characteristics.
Yes, it was a thought exercise which also conveniently pushed on some other areas like static fields.
> I totally agree with John
> that the is a future exercise. And if you can figure out a migration story in
> future, more power to you, but we are not designing value types around that
> A note - at least from the hotspot perspective, enums are not special-cased
> and as you can imagine we are trying to minimize special cases since they
> tend to be sources of bugs, so we would like to keep it that way.
>> On Feb 1, 2018, at 2:05 PM, John Rose <john.r.rose at oracle.com <mailto:john.r.rose at oracle.com>> wrote:
>> On Feb 1, 2018, at 5:24 PM, Paul Sandoz <paul.sandoz at oracle.com <mailto:paul.sandoz at oracle.com>> wrote:
>>> an enum class to also explicitly be a value class
>> Yes, it's probably doable, but we would have to work out the
>> migration story, and also figure out how to manage the Enum
>> supertype. Remember that one of the ongoing challenges
>> of VT's is the role of Object. For value-enums, I think we
>> would reprise the role for Enum. I'd rather have template
>> classes under my belt before tackling that, so I could make
>> Enum behave differently as an object vs. a value supertype.
More information about the valhalla-spec-observers