Skip to content
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

avoid use of deprecated methods (mostly Class.newInstance()) #1774

Merged
merged 6 commits into from
Feb 24, 2022

Conversation

tonihele
Copy link
Contributor

@tonihele tonihele commented Feb 18, 2022

Removes deprecated code and some warnings.

Compiled with JDK 11 (-Xlint:deprecation)...

  • Class.newInstance() was deprecated in Java 9, I replaced it with Class.getDeclaredConstructor().newInstance(); (get empty constructor and call it)
  • new Float() is deprecated, unnecessary boxing
  • new JsonParser() is deprecated, use the static methods instead

@stephengold
Copy link
Member

stephengold commented Feb 18, 2022

"Remove deprecated code" is a bit misleading. Most of the changes seem to be replacing Class.newInstance() invocations with alternative methods that aren't deprecated. Please edit the title of this PR.

The corrections to AppSettings javadoc are unrelated and will be handled by PR #1770. To avoid potential merge conflict, please revert them from this PR.

@stephengold stephengold added this to the Future Release milestone Feb 18, 2022
@tonihele tonihele changed the title Remove deprecated code Cleanup some deprecated code (mostly Class.newInstance()) Feb 19, 2022
@tonihele
Copy link
Contributor Author

tonihele commented Feb 19, 2022

Doesn't seem to show those as merge conflicts, so auto-merge will probably go just fine. However if this still bothers, I can try tomorrow to revert the file, seems best to use some GIT magic since I can't revert a whole commit (too big commits), just the file in the commit.

I adjusted the PR title and also added a better description of the changes. I also cleaned up the Android project which I was a bit hesitant to do yesterday, since the Java versions on Android.... But these methods are present all in Java 8 at least so I guess everything is fine in that regard.

The code base is surprisingly fine in the deprecation regard for a project of this size (and age). Seems to be mostly now internal deprecations about the animation system and the framebuffer change.

@stephengold
Copy link
Member

@tonihele do you believe this PR is ready to be integrated?

@tonihele
Copy link
Contributor Author

@tonihele do you believe this PR is ready to be integrated?

I think so. I didn't have the chance to revert the file you asked. But it looks to me that it will go just fine, without any conflict. So there should be no need to revert the file.

@stephengold stephengold changed the title Cleanup some deprecated code (mostly Class.newInstance()) avoid use of deprecated methods (mostly Class.newInstance()) Feb 24, 2022
@stephengold stephengold merged commit f0918a4 into jMonkeyEngine:master Feb 24, 2022
@stephengold
Copy link
Member

Thanks for your contribution, @tonihele!

@Ali-RS Ali-RS modified the milestones: Future Release, v3.6.0 Dec 31, 2022
@tonihele tonihele deleted the deprecations-cleanup branch January 1, 2023 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants