proposed changes to finalize() #5436
BradWalker
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Please can we keep this discussion on dev@? This sort of conversation belongs there rather than on GitHub discussions. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There is work on the JDK for removing the
finalize()
method.This is covered in JEP 421 Deprecate Finalization for Removal, which was release as part of JDK 18. This work is covered by the following feature request JDK-8274609.
Also, as the the JDK recognized that finalization was going to be removed in the future, they added 2 new fields,
since
andforRemoval
to the@Deprecated
annotation tag in Java 9. So many pieces of code in the core language have been flagged with this annotation.Also, the JLS has this to say "as of Java SE 19, the Java SE Platform Specification allows finalization of class instances to be disabled in an implementation of the Java SE Platform, in anticipation of the removal of finalization from a future release of the Java SE Platform."
Ultimately, the JDK team is going to remove the
Object.finalize()
method, among several, and we are going to be stuck! As several places call this method.So I'm proposing to flag the places in Netbeans code where we need to devote some effort to clean this up. I'm even thinking of maybe being the volunteer for this.
To flag these places, I'm proposing to use the
@Deprecated
annotation tag in our code like the following:ide/editor.lib/src/org/netbeans/editor/MarkBlock.java
This simple change is pretty straightforward. The issue is this makes the code only usable on Java 9 and later releases. So there is going to be a build change that goes along with these modules that get modified.
I'm interested in hearing feedback from everyone about this.
A very preliminary prototype can be found in pull request 5435
Beta Was this translation helpful? Give feedback.
All reactions