Why isn't the @Deprecated annotation triggering a compiler warning about a method?

Posted by Scooter on Stack Overflow See other posts from Stack Overflow or by Scooter
Published on 2012-10-28T10:40:58Z Indexed on 2012/10/28 11:01 UTC
Read the original article Hit count: 187

Filed under:
|

I am trying to use the @Deprecated annotation. The @Deprecated documentation says that: "Compilers warn when a deprecated program element is used or overridden in non-deprecated code". I would think this should trigger it, but it did not. javac version 1.7.0_09 and compiled using and not using -Xlint and -deprecation.

public class test_annotations {

   public static void main(String[] args)
   {
      test_annotations theApp = new test_annotations();
      theApp.this_is_deprecated();
   }

   @Deprecated
   public void this_is_deprecated()
   {
      System.out.println("doing it the old way");
   }
}

© Stack Overflow or respective owner

Related posts about java

Related posts about annotations