You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@netbeans.apache.org by Brad Walker <bw...@musings.com> on 2023/02/05 00:14:25 UTC

use of Deprecated annotation error

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.

Re: use of Deprecated annotation error

Posted by Michael Bien <mb...@gmail.com>.
no problem.

That is also the main reason I really would like to see NB finally move 
to JDK 11 or later, so that it can use more modern APIs.

-mbien


On 05.02.23 01:39, Brad Walker wrote:
> Thanks!
>
> Completely understand.
>
> -brad w.
>
>
> On Sat, Feb 4, 2023 at 6:37 PM Michael Bien <mb...@gmail.com> wrote:
>
>     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.
>     >
>

Re: use of Deprecated annotation error

Posted by Brad Walker <bw...@musings.com>.
Thanks!

Completely understand.

-brad w.


On Sat, Feb 4, 2023 at 6:37 PM Michael Bien <mb...@gmail.com> wrote:

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

Re: use of Deprecated annotation error

Posted by Michael Bien <mb...@gmail.com>.
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-unsubscribe@netbeans.apache.org
For additional commands, e-mail: dev-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists