How can I suppress javac warnings about deprecated api?

前端 未结 9 992
遥遥无期
遥遥无期 2020-12-09 01:40

When I compile, javac outputs:

Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.`
9条回答
  •  有刺的猬
    2020-12-09 02:00

    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 @SuppressWarnings("deprecation") annotation to the classes or methods that are using the deprecated APIs.

提交回复
热议问题