Hi Brad,

the @Deprecated annotation itself is old, however the attributes since/forRemoval are newer (probably JDK11 if I remember correctly).

This means that this will only work in modules which have their bytecode level set to 11 (there aren't many).

Javac of JDK 17 on your system is doing its job, its just that the modules ask for java 8 compatibility so it can't allow those attributes.

hope this helps,
michael



On 05.02.23 01:14, Brad Walker wrote:
I'm pulling my hair out trying to figure something out when I use the
@Deprecaed
annotation.

For example, if I do the following in JarClassLoader.java, line 866

        /** Delete any temporary JARs we were holding on to.
          * Also close any other JARs in our list.
          */
*        @Deprecated(since="9", forRemoval=true)*
         @Override
         protected void finalize() throws Throwable {
             super.finalize();

             doCloseJar();

             if (dead) {
                 LOGGER.log(Level.FINE, "#21114: closing and deleting
temporary JAR {0}", file);
                 if (file.isFile() && !file.delete()) {
                     LOGGER.log(Level.FINE, "(but failed to delete {0})",
file);
                 }
             }
         }

I get the following error:

-do-compile:
    [depend] Deleted 12 out of date files in 0 seconds
  [nb-javac] Compiling 18 source files to
/home/bwalker/src/netbeans/platform/o.n.bootstrap/build/classes
  [nb-javac] Ignoring source, target and bootclasspath as release has been
set
    [repeat]
/home/bwalker/src/netbeans/platform/o.n.bootstrap/src/org/netbeans/JarClassLoader.java:866:
error: cannot find symbol
    [repeat] @Deprecated(since="9", forRemoval=true)
    [repeat]            ^
    [repeat]   symbol:   method since()
    [repeat]   location: @interface Deprecated
    [repeat]
/home/bwalker/src/netbeans/platform/o.n.bootstrap/src/org/netbeans/JarClassLoader.java:866:
error: cannot find symbol
    [repeat] @Deprecated(since="9", forRemoval=true)
    [repeat]                       ^
    [repeat]   symbol:   method forRemoval()
    [repeat]   location: @interface Deprecated
    [repeat] 2 errors
   [nbmerge] Failed to build target: all-o.n.bootstrap

Which says to me that it's compiling with javac for 1.8.

Yet my path is set to use the version 17 of javac..

[bwalker@fedora netbeans]$ javac -version
javac 17.0.5
[bwalker@fedora netbeans]$

Ideas about where I should look for clues?

-brad w.



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