[Records] Why components are not readOnly
Alex Buckley
alex.buckley at oracle.com
Wed Jan 22 16:24:49 UTC 2020
On 1/21/2020 4:04 PM, Valentin Kovalenko wrote:
>> Brian
>> remember that modifying final fields is wholly outside of either the
> language or VM specification
>
> Not that I am advocating for "tacking weird corner-case behavior in a dozen
> different places", but JLS does have a whole paragraph talking about
> modification of final fields via reflection and other
> implementstion-dependent mechanisms.
>
> JLS 15.5.3 says: "final fields can be changed via reflection and other
> implementstion-dependent means".
Not 15.5.3. You mean 17.5.3, deep inside the chapter on the Java Memory
Model. While that chapter underpins field access in Java programs, the
material in 17.5.3 is plainly meant for advanced behavior by "the
system". I recommend a less literal, more charitable reading of Brian's
mail: "modifying final fields is wholly outside of the programming model
available to ordinary Java programs or ordinary JVM bytecode."
Alex
More information about the amber-dev
mailing list