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.
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.
Two possible ways:
@SuppressWarnings("deprecation")
For others that were Google searching this problem and stumble upon this thread like I did...
Try: -Xlint:-deprecation
It seems to work on JDK 6... not sure about others.
use nowarn attribute see below
e.g.
by default nowarn attribute is off
If you are compiling in the command line you can filter the messages with
grep
, just filtering out the messages that has unwanted content, like for examplegrep -v deprecated
. You can use|
to send the output to grep,When using gradle you can configure it easily:
(tested with Gradle 2 and Java 8)
With Java 6, neither the @Depreated annotation, nor a comiler flag will help you here. The only solution that worked for me was to put a javadoc comment with the @deprecated (small caps) tag on the deprecated method:
(The example is from a class that derives from JAXBContext.)
(I didn't import the deprecated Validator class to avoid a warning on the import statement.)