RFR: 8353835: Implement JEP 500: Prepare to Make Final Mean Final [v4]

Alan Bateman alanb at openjdk.org
Tue Sep 30 10:17:08 UTC 2025


On Mon, 29 Sep 2025 19:29:21 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

>> Alan Bateman has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   RemoveFields(duration) and filter internal frames
>
> test/jdk/java/lang/reflect/Field/mutateFinals/MutateFinalsTest.java line 33:
> 
>> 31:  * @run junit/othervm --illegal-final-field-mutation=debug -DwriteAccess=true MutateFinalsTest
>> 32:  * @run junit/othervm --illegal-final-field-mutation=deny -DwriteAccess=false MutateFinalsTest
>> 33:  */
> 
> Shall we also test the defaults too?
> 
> Suggestion:
> 
>  * @run junit/othervm -DwriteAccess=true MutateFinalsTest
>  */

I didn't initially include that as the default has to be one of the 4 options that it already exercises. But you are right, we should add it in case the default could some result in different behavior, thanks for bringing it up.

> test/jdk/java/lang/reflect/Field/mutateFinals/modules/m1/p1/TestMain.java line 105:
> 
>> 103:         var obj = new C(oldValue);
>> 104: 
>> 105:         f.setAccessible(false);
> 
> Shouldn't we avoid tampering the defaults with `f.setAccessible(false)` while validating the default IAE throw?

You are are right that the setAccessible(false) does nothing here but I think makes it clear that it is testing the scenario where access checks have not been suppressed.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/25115#discussion_r2390720820
PR Review Comment: https://git.openjdk.org/jdk/pull/25115#discussion_r2390725922


More information about the core-libs-dev mailing list