diff --git a/src/java/Ref.hxx b/src/java/Ref.hxx index e19ebb930..297da92f0 100644 --- a/src/java/Ref.hxx +++ b/src/java/Ref.hxx @@ -68,8 +68,12 @@ namespace Java { env->DeleteLocalRef(value); } - LocalRef(const LocalRef &other) = delete; - LocalRef &operator=(const LocalRef &other) = delete; + LocalRef &operator=(LocalRef &&src) noexcept { + using std::swap; + swap(env, src.env); + swap(value, src.value); + return *this; + } JNIEnv *GetEnv() const noexcept { return env;