Explore usage of method handles instead of core reflection in ReflectionHelper#getValue()
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:
Java 8 allows to do it via some reflection trickery.
Java 9 provides a new method MethodHandles#privateLookupIn() which addresses this. We'd have to provide a way for letting users pass in such look-up.
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)?
For various reasons, this one should be put on hold.
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.
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.