The java class does something like the following
public class Foo { private final NativeCallbackHandler handler; public Foo(NativeCallbackHandler handler) {
We can assume that the native method does something that could lead to the creation of our own code that calls handleNativeMethod
I have 2 related questions
- I believe that native code should call to have a handle to this object, and also call
GetMethodID in order to access the called method, is it possible for this native code to call the method before the object is fully initialized? - If possible, what is the semantics of the uninitialized final field?
if 1 is yes, then I expect 2 to explode its access, and I think we need to make it an AtomicReference in order to safely access it without an explosion.
Note. I do not control the behavior of my own library.
Matt source share