> On 14 Oct 2015, at 16:15, Remi Forax <[email protected]> wrote:
>
> ----- Mail original -----
>> De: "Paul Sandoz" <[email protected]>
>> Cc: "core-libs-dev" <[email protected]>
>> Envoyé: Mercredi 14 Octobre 2015 13:46:38
>> Objet: Re: java.lang.reflect.Method.copyOf
>>
>>
>>> On 14 Oct 2015, at 12:38, Remi Forax <[email protected]> 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.
>
> Methods are not serializable.
One of the primary motivations for the introduction of the accessibility bit
was serialization:
* <p>Setting the {@code accessible} flag in a reflected object
* permits sophisticated applications with sufficient privilege, such
* as Java Object Serialization or other persistence mechanisms, to
* manipulate objects in a manner that would normally be prohibited.
Paul.