Skip to content

When running tests on Java 26 disallow modification of final fields #15482

@uschindler

Description

@uschindler

Description

JEP 500 is moving to making final fields really final. They are currently be allowed to be modified with deep reflection (using Field#setAccessible(true)) but as we do not allow setAccessible due to forbiddenapis, it is safe to further enforce this, especially to prevent dependencies from doing this. In JDK 26 the default is warn only and in later versions this will change to enforce.

For testing we should pass --illegal-final-field-mutation=deny to our test-runner staring with Java 26. We have similar stuff regarding preventing JNI in earlier Java versions, so the code to do this is already there.

I will check what needs to be done. I think we should wait a bit until the RC of JDK 26 comes out to not fail builds with older versions of JDK 26.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions