Javac 标志禁止原始类型? [英] Javac flag to disallow raw types?

查看:35
本文介绍了Javac 标志禁止原始类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何 Java 编译器标志可以传递给编译器以禁止使用原始类型?也就是说,对于任何泛型类,让编译器强制使用参数化版本,否则抛出编译错误?

Is there any Java compiler flag that one can pass to tell the compiler to disallow the use of raw types? That is, for any generic class, let the compiler force that the parameterized version be used, and throw a compilation error otherwise?

推荐答案

JDK7 (b38) 引入了 -Xlint:rawtypes.如上所述,-Xlint:unchecked 警告未经检查的转换.

JDK7 (b38) introduces -Xlint:rawtypes. As mentioned above, -Xlint:unchecked warns about unchecked conversions.

javac 团队的 Maurizio Cimadamore 写了一篇关于它的网络日志条目.

Maurizio Cimadamore of the javac team wrote a weblog entry about it.

这篇关于Javac 标志禁止原始类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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