MCPcopy Create free account
hub / github.com/catboost/catboost / FindClass

Method FindClass

library/cpp/jni/jni.cpp:256–273  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

254}
255
256TLocalClassRef TJniEnv::FindClass(std::string_view name) const {
257 TLocalClassRef localRef;
258 if (Resources->ClassLoader && Resources->LoadMethod) {
259 auto jname = NewStringUTF(name);
260 // To cast to TClassRef, we should firstly release TLocalRef.
261 //
262 auto clazz = static_cast<jclass>(CallObjectMethod(Resources->ClassLoader.Get(),
263 Resources->LoadMethod, jname.Get()).Release());
264 localRef = TLocalClassRef(clazz);
265 } else {
266 // May be system class loader, that doesn't know anything. (it depends on execution thread).
267 //
268 auto* env = GetJniEnv();
269 localRef = TLocalClassRef(env->FindClass(name.data()));
270 }
271 Check();
272 return localRef;
273}
274
275jmethodID TJniEnv::GetMethodID(jclass clazz, std::string_view name, std::string_view signature,
276 bool isStatic) const

Callers

nothing calls this directly

Calls 4

CheckFunction · 0.70
ReleaseMethod · 0.45
GetMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected