RFR: JDK-8216558: Lookup.unreflectSetter(Field) fails to throw IllegalAccessException for final fields

Mandy Chung mandy.chung at oracle.com
Thu Feb 21 17:37:54 UTC 2019

Hi Adam,

On 2/14/19 3:16 AM, Adam Farley8 wrote:
> Hi Mandy,
> Apologies for the delay.

Same here as I returned from vacation yesterday.

> Could you review this cdiff as a proposal for the jtreg test?
> Made sense to modify the existing test set for MethodHandle rather than 
> add a new one.

Yes it'd be better if you extend the MethodHandlesGeneralTest and
MethodHandlesTest to test the write access.

To add the test cases properly, MethodHandlesTest.HasFields
should be modified to include the read-only fields.  It might
be cleaner to add a new HasReadOnlyFields class and maybe a new
TEST_SET_ACCESSIBLE bit that requests to call setAccessible(true)
and testSetter expects unreflectSetter to throw exception on
static final fields (possibly additional bits might be needed).


More information about the core-libs-dev mailing list