Commit 31f7fede authored by Max Kellermann's avatar Max Kellermann Committed by Max Kellermann

java/GlobalRef: remove method Set(), always require initialization

parent 917fe549
......@@ -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);
......
......@@ -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;
}
......
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