> On 14 Oct 2015, at 12:38, Remi Forax <fo...@univ-mlv.fr> wrote: > > Given that j.l.r.Method is mutable, the best way to have performance is too > encapsulate it in a non mutable class, if possible. > > As far as i know j.l.r.Method was introduced in Java 1.1 as non mutable and > become mutable with Java 1.2, (yes, someone seriously fucked up !)
Some harsh language there :-) I don’t know the full history but i like to think this may have been a frustrating compromise due to some demanding serialization requirements under a tight schedule. It’s definitely annoying that there is a mutable bit associated with each accessible object, which in turn has an impact a number of fundamental areas (such as final fields, strong module boundaries) Paul. > so methods like copyOf were introduced to do defensive copies (the sharing > mechanism was later introduced, in 1.4, i believe). > > cheers, > Rémi