added an issue to track this: https://github.com/apache/netbeans/issues/5440
we have a similar for-removal issue regarding Thread.stop here: https://github.com/apache/netbeans/issues/4952 -mbien On 05.02.23 19:07, Brad Walker wrote:
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 <https://bugs.openjdk.org/browse/JDK-8274609>. Also, as the JDK team recognized that finalization was going to be removed in the future, they added 2 new fields, since and forRemoval 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* /** Destroy the marks if necessary */ @Deprecated(since="9", forRemoval=true) protected void finalize() throws Throwable { destroyMarks(); super.finalize(); } 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. The only thing that I'm proposing right now is that we mark code with this annotation. I'm interested in hearing feedback from everyone about this. A very preliminary prototype can be found in pull request 5435 <https://github.com/apache/netbeans/pull/5435>
--------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org For additional commands, e-mail: dev-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists