Review Request: JDK-8220282 Add MethodHandle tests on accessing final fields

Mandy Chung mandy.chung at
Wed Mar 27 02:58:20 UTC 2019

This is a new version of the patch:

I made further clean up to this new test.

It extends MethodHandlesTest.HasFields class to include the test
cases for instance final fields.  HasFields is used to test
findGetter/findStaticGetter, findSetter/findStaticSetter, and

A new HasFields::testCasesFor(int testMode) method is added to
return the test cases where c[1] == Error.class indicates a
negative test case.

For getters, all HasFields except bogus_xx fields are positive
test cases, i.e. no exception is expected.

For findSetter/findStaticSetter, a final field has no write access
and setting on a final field is a negative test case.

For unreflectSetter, non-final fields and instance final fields
whose accessible flag is true have write access and hence they
are positive test cases whereas static final fields are negative
test cases.


More information about the core-libs-dev mailing list