Where does this array come from ?

forax at univ-mlv.fr forax at univ-mlv.fr
Wed Apr 8 14:45:34 UTC 2020


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