IdentityObject and InlineObject

forax at univ-mlv.fr forax at univ-mlv.fr
Sat Dec 7 19:48:04 UTC 2019


> De: "John Rose" <john.r.rose at oracle.com>
> À: "Brian Goetz" <brian.goetz at oracle.com>
> Cc: "Remi Forax" <forax at univ-mlv.fr>, "valhalla-spec-experts"
> <valhalla-spec-experts at openjdk.java.net>
> Envoyé: Samedi 7 Décembre 2019 02:31:48
> Objet: Re: IdentityObject and InlineObject

> On Dec 6, 2019, at 2:28 PM, Brian Goetz < [ mailto:brian.goetz at oracle.com |
> brian.goetz at oracle.com ] > wrote:

>> public class IdentityHashMap<E extends Object&IdentityObject> { ... }

> (There’s your erasure trick, Remi, used against you. Brian has no mercy!)

No, it's actually a good question ! 

First, it only works for one of the 3 examples I have given. 
Then i've found that using this trick useful on generic static method and far less useful on generic classes because those can have subclasses. 

By example, in the case of IdentityHashMap, you only delay the issue because any classes that inherits from IdentityHashMap<IdentityObject, ...> (and IdentityHashMap with the (first) type argument specified) is not binary backward compatible. 

Rémi 


More information about the valhalla-spec-observers mailing list