Hi Remi, Thanks, that was what I assumed as well. It was only because Lookup.unreflectVarHandle() was very particular about every possible modifier type. That I had a second of doubt.
Best, Kasper On Sun, 16 Jun 2019 at 12:03, Remi Forax <fo...@univ-mlv.fr> wrote: > > Hi Kasper, > as usual, a getter on a volatile field will return a method handle that does > a volatile read. > The idea of the basic methodhandles, the one for field access, method calls, > etc is to have exactly the same semantics as the bytecode equivalent, so > unreflectGetter works like getfield and unreflectSetter like putfield. > > If you want a different semantics, you can use the VarHandles. > > regards, > Rémi > > ----- Mail original ----- > > De: "Kasper Nielsen" <kaspe...@gmail.com> > > À: "core-libs-dev" <core-libs-dev@openjdk.java.net> > > Envoyé: Dimanche 16 Juin 2019 12:16:24 > > Objet: Lookup.unreflectSetter/unreflectGetter and volatile fields > > > Hi, > > > > Can anyone tell me how Lookup.unreflectSetter(Field) and > > Lookup.unreflectGetter(Field) works with volatile fields. > > Nothing is mentioned in the Javadoc of the methods. And by looking at > > the code for Lookup I couldn't really get a clearer picture. > > > > Thanks > > Kasper