> On 9 Jan 2017, at 13:27, Martin Buchholz <marti...@google.com> wrote: > > My whitebox tests tend to use private access only for reading, but I can > imagine cases where it is useful to give testing code stronger access than > for regular VarHandles, maybe even to write final fields, for example for > fuzz testing or reliably creating an internal state that can only happen with > a race. There's may be a case for providing such a big hammer, if it's > sufficiently hard to get at, but I can live without it. >
That big hammer could be jdk.internal.misc.Unsafe for certain tightly bound tests that really need it. > My preference would be to encourage people to use > MethodHandles.privateLookupIn. > > I'm a convert! Great! > It will take a while for privateLookupIn to become "common knowledge". > I shall endeavour to mention it at Devoxx US in March where John and I will present on java.lang.invoke. Paul.