Explore usage of method handles instead of core reflection in ReflectionHelper#getValue()

Description

Supposedly, method handles are a bit more efficient than using Core reflection. That'll require some proper measuring using JMH.

One challenge will be how to obtain method handles for non-public bean members, e.g. private fields:

The latter would require some SPI which returns a Lookup with private access for a given class. An interesting question is how open modules play into that. Can we obtain lookups with private access to the user's classes from within Hibernate Validator itself (i.e. no SPI is needed), if the user module is an open module (or opens its beans specifically to HV)?

Environment

None

Activity

Show:
Gunnar Morling
June 30, 2017, 9:06 AM

I've blogged about method and var handles recently: http://in.relation.to/2017/04/11/accessing-private-state-of-java-9-modules/.

One thing to keep in mind is that deep reflection will be allowed by default again in Java 9 as per the recent addition of the "big kill switch". Still we should be prepared for this not being the default any longer. As we require Java 8 now anyways, I think we can already do the switch to method handles right now.

Gunnar Morling
October 20, 2017, 2:38 PM

Hey , I'm not sure whether we discussed this one before, but in any case it'd be a very cool thing to work on if you look for an issue to grab.

Guillaume Smet
December 9, 2018, 9:30 AM

For various reasons, this one should be put on hold.

Assignee

Unassigned

Reporter

Gunnar Morling

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Priority

Major
Configure