如何使用 -Xlint:unchecked 进行编译? [英] How do I compile with -Xlint:unchecked?

查看:52
本文介绍了如何使用 -Xlint:unchecked 进行编译?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在编译代码时收到一条消息:

I'm getting a message when I compile my code:

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

如何使用 -Xlint:unchecked 重新编译?

How do I recompile with -Xlint:unchecked?

推荐答案

在 javac 的命令行中指定:

Specify it on the command line for javac:

javac -Xlint:未选中

javac -Xlint:unchecked

或者如果你使用 Ant 修改你的 javac 目标

Or if you are using Ant modify your javac target

  <javac ...>
    <compilerarg value="-Xlint"/>
  </javac> 

如果您使用 Maven,请在 中进行配置Maven 编译器插件

If you are using Maven, configure this in the maven-compiler-plugin

<compilerArgument>-Xlint:unchecked</compilerArgument>

这篇关于如何使用 -Xlint:unchecked 进行编译?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆