Where does this array come from ?

Brian Goetz brian.goetz at oracle.com
Wed Apr 8 14:47:41 UTC 2020


At one point we considered having a way to invoke the default implementation (e.g., default.toString()), but after more consideration, felt this didn’t carry its weight.  

The obvious answer is: write it!  

> On Apr 8, 2020, at 10:45 AM, forax at univ-mlv.fr wrote:
> 
> This remember me something,
> let suppose I have this record,
>  record Point(int x, int y) { }
> 
> and I want toString() to return the same string as usual but with a bang " !" at the end,
> how am i suppose to do that ? (obviously the code has to work even if i add new record components).
> 
> Rémi
> 
> ----- Mail original -----
>> De: "Brian Goetz" <brian.goetz at oracle.com>
>> À: "Mateusz Romanowski" <romanowski.mateusz at gmail.com>
>> Cc: "Remi Forax" <forax at univ-mlv.fr>, "amber-dev" <amber-dev at openjdk.java.net>
>> Envoyé: Mercredi 8 Avril 2020 16:34:37
>> Objet: Re: Where does this array come from ?
> 
>>> Yes, but the record class author can still override Object methods, right?
>> 
>> Sort of!  jl.Record, the implicit super type, overrides equals, hashCode, and
>> toString with refined (strengthened) semantics.  So you can’t override
>> Object::equals, but you can override Record::equals (which of course has to
>> conform to the semantics of Object::equals, but also does more.)



More information about the amber-dev mailing list