Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6308178

SuppressWarnings(dep-ann) suppresses some of calling class [deprecation] warning.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • 6
    • 6
    • tools
    • generic
    • generic

      Tried on Solaris -10
      JDK :java version "1.6.0-ea" (build 1.6.0-ea-b46)

      SuppressWarning(dep-ann) suppresses sum of calling class [deprecation] warnings.
      See the following code
      <code>
      class Bar{
          Foo foo = new Foo();
      }
      //@SuppressWarnings("dep-ann")
      /** @deprecated */
      @Deprecated
      public class Foo{
      }
      </code>
      Output the when compiled
      <Output>
      bash-3.00$ javac -Xlint Foo.java
      Foo.java:2: warning: [deprecation] Foo in unnamed package has been deprecated
          Foo foo = new Foo();
          ^
      Foo.java:2: warning: [deprecation] Foo in unnamed package has been deprecated
          Foo foo = new Foo();
                        ^
      2 warnings
      </Output>
      Output is fine but when SuppressWarning(dep-ann) is un commented then first [deprecation] warning will be suppressed.
      <code>
      class Bar{
          Foo foo = new Foo();
      }
      @SuppressWarnings("dep-ann")
      /** @deprecated */
      @Deprecated
      public class Foo{
      }
      </code>
      Then output
      <output>
      bash-3.00$ javac -Xlint Foo.java
      Foo.java:2: warning: [deprecation] Foo in unnamed package has been deprecated
          Foo foo = new Foo();
                        ^
      1 warning
      </output>
      One [deprecation] warning has been suppressed.

            jjg Jonathan Gibbons
            savadhansunw Seetharama Avadhanam (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: