From 31f7fede30d4f433f6dc70c9ea64fc0d6506042d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 23 Jul 2021 18:19:53 +0200 Subject: [PATCH] java/GlobalRef: remove method Set(), always require initialization --- src/android/AudioManager.hxx | 4 ---- src/java/Ref.hxx | 17 ----------------- 2 files changed, 21 deletions(-) diff --git a/src/android/AudioManager.hxx b/src/android/AudioManager.hxx index 78cf94eea..115385dba 100644 --- a/src/android/AudioManager.hxx +++ b/src/android/AudioManager.hxx @@ -30,10 +30,6 @@ class AudioManager : public Java::GlobalObject { public: AudioManager(JNIEnv *env, jobject obj) noexcept; - AudioManager(std::nullptr_t) noexcept { maxVolume = 0; } - - ~AudioManager() noexcept {} - int GetMaxVolume() { return maxVolume; } int GetVolume(JNIEnv *env); void SetVolume(JNIEnv *env, int); diff --git a/src/java/Ref.hxx b/src/java/Ref.hxx index a5ad2b0d3..18b48f865 100644 --- a/src/java/Ref.hxx +++ b/src/java/Ref.hxx @@ -110,12 +110,6 @@ class GlobalRef { T value; public: - /** - * Constructs an uninitialized object. The method - * set() must be called before it is destructed. - */ - GlobalRef() = default; - GlobalRef(JNIEnv *env, T _value) noexcept :value(_value) { @@ -135,17 +129,6 @@ public: GlobalRef(const GlobalRef &other) = delete; GlobalRef &operator=(const GlobalRef &other) = delete; - /** - * Sets the object, ignoring the previous value. This - * is only allowed once after the default constructor - * was used. - */ - void Set(JNIEnv *env, T _value) noexcept { - assert(_value != nullptr); - - value = (T)env->NewGlobalRef(_value); - } - T Get() const noexcept { return value; }