Hi Brad,

Am Sonntag, dem 05.02.2023 um 12:07 -0600 schrieb Brad Walker:
> #finalize is deprecated
>
> 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();
>     }


what is the intention of this change? #finalize is called by the JDK
and not by user code. The javac already reports overrides of #finalize
as warnings, if you compile against a JDK that actually has the
deprecation and if the warnings will be visible.

You can test this with your sample, change
ide/editor.lib/project.properties to hold:

javac.compilerargs=-Xlint:unchecked -Xmaxwarns 2000
javac.source=8
javac.target=11

Then you'll find:

/home/matthias/src/netbeans/ide/editor.lib/src/org/netbeans/editor/MarkBlock.java:555:
 warning: [deprecation] finalize() in Object has been deprecated
    protected void finalize() throws Throwable {
/home/matthias/src/netbeans/ide/editor.lib/src/org/netbeans/editor/MarkBlock.java:557:
 warning: [deprecation] finalize() in Object has been deprecated
        super.finalize();

It will not stand out inside the 600+ other warnings.

Greetings

Matthias

---------------------------------------------------------------------
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



Reply via email to