lundi 26 octobre 2020

Convert VarHandle to java.lang.reflect.Field

Is there any way to convert from a VarHandle to a java.lang.reflect.Field? With a (getter/setter) MethodHandle, one can use MethodHandles.reflectAs(Field.class, handle) to go from MethodHandle to Field or lookup.unreflect{Getter|Setter}(field) to go from Field to MethodHandle. Similarly, one can use lookup.unreflectVarHandle(field) to go from Field to VarHandle, but there doesn't seem to be any equivalent way to go from VarHandle to Field.





Aucun commentaire:

Enregistrer un commentaire