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

javac reports deprecation warnings for deprecated types used in deprecated metho

    XMLWordPrintable

Details

    • Bug
    • Resolution: Cannot Reproduce
    • P4
    • 7
    • 6u22
    • tools
    • x86
    • windows_xp

    Description

      FULL PRODUCT VERSION :
      java version "1.6.0_21"
      Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
      Java HotSpot(TM) Client VM (build 17.0-b17, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      I have a java library whose classes/methods I'm deprecating because I've come up with a new mechanism for achieving the same functionality. The deprecated classes/methods refer to one another, and for the most part I don't get deprecated warnings for these (and this is good). But for the case where a method in one deprecated class takes an argument of a different deprecated class, I get a warning (which I think is a javac bug) stating that the argument class is deprecated. Furthermore, @SuppressWarnings("deprecation") doesn't help (which I'm almost certain is a bug).


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      X.java:
      @Deprecated public class X
      {
          void add(Y y)
          {
          }
      }

      Y.java:
      @Deprecated public class Y
      {
      }

      Compile them:
      javac -deprecation *.java


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No warnings because X is deprecated, so methods in it that take arguments of deprecated type Y shouldn't be a problem.
      ACTUAL -
      X.java:15: warning: [deprecation] Y in unnamed package has been deprecated
          void add(Y y)

      The line number would be different for you; I removed some comments generated by my code formatter.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      See Steps to Reproduce for the example.
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Don't deprecate class Y, but rather deprecate all of the methods in it. Very annoying for large classes Y.

      Attachments

        Activity

          People

            jlahoda Jan Lahoda
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: