I'm very new to Java/Android development, coming from C/C++. I'm working on a JNI lib and its java API.
I need a java function (or any other beast) that takes a long
variable as a parameter, uses its value, and assigns another value to it. In simple words, an equivalent C/C++ code would look like this:
void ReleaseObj(long& nObj)
{
if (nObj)
{
// call a native method that actually releases it
// ...
nObj = 0; // assign the variable to 0
}
}
Now, I know there are no references in Java, as well as there's no way to get a pointer to the variable. But is there a trick that may achieve this? Perhaps a macro (are there macros in Java?).
To work this around currently I've created a wrapper java class that just wraps this long
variable and has a public method that does exactly this, but this seems an overkill to me.
Thanks in advance.