Class AbstractNativeProxy

    • Field Detail

      • nativeHandle

        protected final NativeHandle nativeHandle
        A handle to the native object.
    • Constructor Detail

      • AbstractNativeProxy

        protected AbstractNativeProxy​(NativeHandle nativeHandle)
    • Method Detail

      • getNativeHandle

        protected long getNativeHandle()
        Returns a handle to the native object if it may be safely used to access the native object. Equivalent to nativeHandle.get().

        The returned value shall only be passed as an argument to native methods.

        Warning: do not cache the return value, as you won't be able to catch use-after-free.

        Throws:
        IllegalStateException - if the native handle is invalid (closed or nullptr)
      • isValidHandle

        protected final boolean isValidHandle()
        Returns true if this proxy has a valid native handle.