We need a new native method, VM.getStackClass(int) to compliment VM.getStackClassLoader() and Class.getStackClasses(). It needs to be implemented in the VM vendors. I can fix Android's Dalvik VM, but I'll need a Harmony volunteer to fix DRLVM.
To implement AtomicReferenceFieldUpdater securely, it's necessary to capture the class of the caller, not just the class loader of the caller. Otherwise a rogue class (say, EvilBufferedInputStream) could use an AtomicReferenceFieldUpdater to modify protected fields of arbitrary instances (such as the buffer field of somebody else's BufferedInputStream).
HARMONY-6262, which updates of our copy of java.util.concurrent to Doug Lea's latest. The getStackClass() call is needed for line 181 and its result is used on line 262: