gpt4 book ai didi

Javac:选项编译没有注释

转载 作者:搜寻专家 更新时间:2023-11-01 03:39:18 24 4
gpt4 key购买 nike

javac有没有编译不加注释的编译器选项?

我知道:

  • -nowarn : 不显示警告
  • -g:none : 不生成调试信息

仍然会使用这两种方式生成注释。是否也有不生成注释的编译器选项?

“注释”是指编译器输出,例如:

Note: Exercise.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

我使用 javac 1.7.0_40

最佳答案

不是真正的 javac 选项,但值得一提...

如果你不想显示任何编译输出。

in unix: javac ... > /dev/null

in windows: javac ... > NUL

经过一些研究 ( How can I suppress javac warnings about deprecated api? )

"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."

"Two possible ways:

  1. don't use deprecated API
  2. Use @SuppressWarnings("deprecation")

关于Javac:选项编译没有注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19197708/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com