Skip to content

Commit

Permalink
Add ClassLoader type and associated func/methods
Browse files Browse the repository at this point in the history
M	jnigi.go
  • Loading branch information
timob committed Apr 11, 2024
1 parent 2b02f0a commit 7cefc64
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions jnigi.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,19 @@ func UseJVM(pvm unsafe.Pointer, penv unsafe.Pointer, thiz unsafe.Pointer) (*JVM,
return jvm, env
}

type ClassLoaderRef struct {
ref unsafe.Pointer
}

func (r *Env) GetClassLoader(obj *ObjectRef) *ClassLoaderRef {
classLoader := getClassLoader(r.jniEnv, (unsafe.Pointer)(obj.jobject))
return &ClassLoaderRef{classLoader}
}

func (r *Env) SetClassLoader(classLoader *ClassLoaderRef) {
r.addtlClassLoader = classLoader.ref
}

// AttachCurrentThread calls JNI AttachCurrentThread.
// Must call runtime.LockOSThread() first.
func (j *JVM) AttachCurrentThread() *Env {
Expand Down

0 comments on commit 7cefc64

Please sign in to comment.