Java/String: inherit the super class constructor

This commit is contained in:
Max Kellermann 2021-03-28 13:24:00 +02:00 committed by Max Kellermann
parent f58c14a74a
commit 2d95ac2e94
2 changed files with 3 additions and 2 deletions

View File

@ -45,6 +45,8 @@ class File : public LocalObject {
static jmethodID getAbsolutePath_method; static jmethodID getAbsolutePath_method;
public: public:
using LocalObject::LocalObject;
gcc_nonnull_all gcc_nonnull_all
static void Initialise(JNIEnv *env) noexcept; static void Initialise(JNIEnv *env) noexcept;

View File

@ -44,8 +44,7 @@ namespace Java {
*/ */
class String : public LocalRef<jstring> { class String : public LocalRef<jstring> {
public: public:
String(JNIEnv *env, jstring value) noexcept using LocalRef::LocalRef;
:LocalRef<jstring>(env, value) {}
String(JNIEnv *_env, const char *_value) noexcept String(JNIEnv *_env, const char *_value) noexcept
:LocalRef<jstring>(_env, _env->NewStringUTF(_value)) {} :LocalRef<jstring>(_env, _env->NewStringUTF(_value)) {}