Commit c9a9248c authored by Max Kellermann's avatar Max Kellermann Committed by Max Kellermann

java/Class: use Java::LocalObject

This eliminates all but one DeleteLocalRef() call.
parent 31f7fede
......@@ -58,23 +58,21 @@ public:
assert(env != nullptr);
assert(name != nullptr);
jclass cls = env->FindClass(name);
const Java::Class cls{env, env->FindClass(name)};
assert(cls != nullptr);
Set(env, cls);
env->DeleteLocalRef(cls);
}
bool FindOptional(JNIEnv *env, const char *name) noexcept {
assert(env != nullptr);
assert(name != nullptr);
jclass cls = env->FindClass(name);
const Java::Class cls{env, env->FindClass(name)};
if (DiscardException(env))
return false;
Set(env, cls);
env->DeleteLocalRef(cls);
return true;
}
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment