-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Java: rename the delete
function to _internalDelete
and make private
#350
Comments
Not sure about fixed name, may be I will add option to regulate naming scheme. |
Would you accept a PR where I rename Thanks! |
At the moment, Java classes are created with a special `delete` function that is in charge of clearing the Rust object, e.g.: ``` public synchronized void delete() { if (mNativeObj != 0) { do_delete(mNativeObj); mNativeObj = 0; } } ``` Delete is quite a useful name to have (I use it in my API) and this function being called this way is confusing, but also needlessly limits the API. Fixes Dushistov#350
At the moment, Java classes are created with a special `delete` function that is in charge of clearing the Rust object, e.g.: ``` public synchronized void delete() { if (mNativeObj != 0) { do_delete(mNativeObj); mNativeObj = 0; } } ``` Delete is quite a useful name to have (I use it in my API) and this function being called this way is confusing, but also needlessly limits the API. Fixes Dushistov#350
At the moment, Java classes are created with a special `delete` function that is in charge of clearing the Rust object, e.g.: ``` public synchronized void delete() { if (mNativeObj != 0) { do_delete(mNativeObj); mNativeObj = 0; } } ``` Delete is quite a useful name to have (I use it in my API) and this function being called this way is confusing, but also needlessly limits the API. Fixes Dushistov#350
I have what seems to be a working patch, though I think |
Such change can broke code of other users.
with such change their code would be broken,
Actually you don't need fork, you can use new extension method: it takes generated java code as |
flapigen 0.6.0 is not yet released, now is exactly the time to change it (rather than later), no? As for your suggestion, I don't think it will work, as I believe it breaks even before that (I'm getting rust compilation errors, look at my patch, the destructor is registered as a function too). |
You get full java code in this callback, how it is possible that this will not work ¯_(ツ)_/¯ ,
Changing is possible, but not breaking without fix changing. Renaming is one thing, users can just change method name in their code,
Yes, but if user uses native code from JVM the probability that he/she uses something not trivial increases. |
As I said, the error I'm getting is before the Java part, it's in Rust. The Rust compiler is complaining... I'm not sure, maybe it will, work, but I don't think it will, and I've settled on running my own fork of flapigen for now.
Gotcha.
I don't see how that's different to any other Java code that could hold a lot of resources. If you want manual control, expose some manual control in the API and free the resources. I think this is very much a corner case rather than the main one, and anyway, by not doing anything you enable both, while what's there now is unnecessarily strict for many use cases. |
At the moment, Java classes are created with a special `delete` function that is in charge of clearing the Rust object, e.g.: ``` public synchronized void delete() { if (mNativeObj != 0) { do_delete(mNativeObj); mNativeObj = 0; } } ``` Delete is quite a useful name to have (I use it in my API) and this function being called this way is confusing, but also needlessly limits the API. Fixes Dushistov#350
Hey,
At the moment, Java classes are created with a special
delete
function that is in charge of clearing the Rust object, e.g.:Delete is quite a useful name to have (I use it in my API) and this function being called this way is confusing, but also needlessly limits the API. It would be much better if the function was
private
(so it's not autocompleted by editors) and called something else so thedelete
name can be used in API.Thanks!
The text was updated successfully, but these errors were encountered: