yes,
the meta-protocols used are not the same (currently ?),
- For records, the BSM is called with an array of method handles because a 
record defined an order (the order of the primary constructor)
- For value type, the BSM doesn't use any supplementary constants (yet ?)

Note that means that because the method handles are resolved eagerly (at least 
now *), a record can not reference a non existing class that will have it's 
field initialized with null.
Note2: the implementation i've provided will not resolved the classes of the 
field too eagerly but it will still try to load the field class even if the 
field is null.

I'm not sure these small differences are enough to justify to have two 
implementations, but the requirements are not exactly the same.

regards,
Rémi

* we should restart our discussions about how to lazy resolved bootstrap 
constant soon.

----- Mail original -----
> De: "Brian Goetz" <brian.go...@oracle.com>
> À: "Remi Forax" <fo...@univ-mlv.fr>, "valhalla-spec-experts" 
> <valhalla-spec-experts@openjdk.java.net>
> Cc: "mandy chung" <mandy.ch...@oracle.com>
> Envoyé: Jeudi 21 Juin 2018 22:53:57
> Objet: Re: toString/equals/hashCode implemented using method handles

>> As discussed during our today meeting,
>> here is an implementation of toString, equals and hashCode that can be used 
>> as
>> default implementation of these methods for value types.
> 
> There is also similar code in the Amber repo for records.  At some
> point, we should have a bake-off and pick the best implementation;
> surely we should only have one.

Reply via email to