diff --git a/app/android.c b/app/android.c index d2f1db2..08f350f 100644 --- a/app/android.c +++ b/app/android.c @@ -37,19 +37,6 @@ static jmethodID find_method(JNIEnv *env, jclass clazz, const char *name, const return m; } -static jclass app_class_loader; -static jmethodID app_find_class_fn; - -// app_find_class finds the given class using the class loader cached -// during JNI_OnLoad. This allows the bind/java package and other -// part of JNI to dynamically load java classes from non-Java threads. -// -// http://developer.android.com/training/articles/perf-jni.html#faq_FindClass -jclass app_find_class(JNIEnv* env, const char* name) { - jstring classname = (*env)->NewStringUTF(env, name); - return (*env)->CallObjectMethod(env, app_class_loader, app_find_class_fn, classname); -} - jint JNI_OnLoad(JavaVM* vm, void* reserved) { JNIEnv* env; if ((*vm)->GetEnv(vm, (void**)&env, JNI_VERSION_1_6) != JNI_OK) { @@ -60,18 +47,6 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) { current_ctx = NULL; current_native_activity = NULL; - // cache the class loader for use in JNI threads. - jclass a_clazz = (*env)->FindClass(env, "go/Go"); - jclass clazz_clazz = (*env)->GetObjectClass(env, a_clazz); - jclass class_loader_clazz = (*env)->FindClass(env, "java/lang/ClassLoader"); - jmethodID get_class_loader = (*env)->GetMethodID(env, clazz_clazz, "getClassLoader", - "()Ljava/lang/ClassLoader;"); - jclass loader = (*env)->CallObjectMethod(env, a_clazz, get_class_loader); - app_class_loader = (*env)->NewGlobalRef(env, loader); - - app_find_class_fn = (*env)->GetMethodID(env, class_loader_clazz, "findClass", - "(Ljava/lang/String;)Ljava/lang/Class;"); - return JNI_VERSION_1_6; } diff --git a/app/android.go b/app/android.go index 1c762a1..f0f29d9 100644 --- a/app/android.go +++ b/app/android.go @@ -205,12 +205,6 @@ func (Config) JavaVM() unsafe.Pointer { return unsafe.Pointer(C.current_vm) } -// ClassFinder returns a C function pointer for finding a given class using -// the app class loader. (jclass) (*fn)(JNIEnv*, const char*). -func (Config) ClassFinder() unsafe.Pointer { - return unsafe.Pointer(C.app_find_class) -} - func (Config) AndroidContext() unsafe.Pointer { return unsafe.Pointer(C.current_ctx) }