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

@SuppressWarnings("deprecation") does not work when overriding deprecated method

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8
    • tools
    • b04
    • Verified

        Consider this example:
        -----
        public class Depr implements Intf {
            @SuppressWarnings("deprecation")
            public void test() { }
        }

        interface Intf {
            @Deprecated void test();
        }
        -----

        Running with -Xlint:deprecation produces this:
        -----
        $ javac -Xlint:deprecation Depr.java
        Depr.java:3: warning: [deprecation] test() in Intf has been deprecated
            public void test() { }
                        ^
        1 warning
        -----

        While the warning should probably be suppressed by the @SuppessWarnings annotation.

        This can be reproduced with:
        -----
        $ javac -fullversion
        javac full version "1.8.0-ea-b121"
        -----

        See original bugreport:
        https://netbeans.org/bugzilla/show_bug.cgi?id=241275

              jlahoda Jan Lahoda
              jlahoda Jan Lahoda
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: