diff --git a/src/jnienv.cpp b/src/jnienv.cpp index 6872d775f1..420feaec12 100644 --- a/src/jnienv.cpp +++ b/src/jnienv.cpp @@ -349,12 +349,16 @@ findClass(Thread* t, uintptr_t* arguments) object caller = getCaller(t, 0); - return reinterpret_cast - (makeLocalReference - (t, getJClass - (t, resolveClass - (t, caller ? classLoader(t, methodClass(t, caller)) - : root(t, Machine::AppLoader), n)))); + object c = resolveClass(t, + caller ? classLoader(t, methodClass(t, caller)) + : root(t, Machine::AppLoader), + n); + + PROTECT(t, c); + + initClass(t, c); + + return reinterpret_cast(makeLocalReference(t, getJClass(t, c))); } jclass JNICALL