views:

1074

answers:

3

When I compile, javac outputs:

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.`

I wish to suppress this warning. Trying -Xlint:none does not seem to help

+11  A: 

Two possible ways:

  1. don't use deprecated API
  2. Use @SuppressWarnings("deprecation")
Joachim Sauer
1. don't use deprecated API; 2. think twice before using a deprecated API; 3. Use @SuppressWarnings("deprecation"). :) +1
Bart Kiers
I asked how to turn off the warning. Obviously I can avoid using deprecated API, but since the code base involves two teams, I cannot persuade them all to do that.
IttayD
+1  A: 

If it's a core Java API, there is almost certainly a replacement that will do what you want. Run the javac with that extra parameter, and then look at the API for the deprecated method and replace as appropriate.

Matt Poush
+3  A: 

From what I can tell in the docs, you can't do it on the command-line.

According to the javac documentation, -Xlint:none only disables warnings "not mandated by the Java Language Specification". It appears that warning you of the use of deprecated APIs is managed by the language spec.

Your best option would be to fix the use of deprecated APIs. However, an option would be to add the @SupressWarnings("deprecation") annotation to the classes or methods that are using the deprecated APIs.

Thomas Owens