JavaRef class
A handle to a Java object.
Use-after-release throws a JniError rather than passing a dangling pointer to the VM, which would be an undebuggable crash.
Constructors
-
JavaRef(Jvm jvm, Pointer<
Void> pointer, JavaRefKind kind)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- isNull → bool
-
truewhen this handle wraps Javanull.no setter - isReleased → bool
-
trueonce release has run.no setter - jvm → Jvm
-
final
- kind → JavaRefKind
-
Whether this handle owns a local or a global reference.
final
-
pointer
→ Pointer<
Void> -
The raw
jobject.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
isSameObject(
JavaRef other) → bool -
truewhen both handles refer to the same Java object (or both arenull). Reference identity, i.e. Java's==, notequals. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
release(
) → void -
Releases the underlying reference. Idempotent, and safe on a
nullref. -
toGlobal(
) → JavaRef - Promotes this reference to a global one, which survives the current thread and frame.
-
toLocal(
) → JavaRef - Creates a new local reference to the same object.
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited