英文:
Unchecked cast warning vs Unchecked conversion warning, what's the difference between them?
问题
在《Effective Java》一书中,我发现有未经检查的强制转换警告和未经检查的转换警告。
> 当您使用泛型进行编程时,您会看到许多编译器警告:未经检查的强制转换警告、未经检查的方法调用警告、未经检查的参数化可变参数类型警告以及未经检查的转换警告。
我认为如果编译器无法验证类型,将会抛出未经检查的强制转换警告。那么在强制转换和转换方面有什么区别呢?还有关于 Java 警告的参考文档吗?
提前感谢您的回答
英文:
In Effective Java, I find there are unchecked cast warning and unchecked conversion warning.
> When you program with generics, you will see many compiler warnings: unchecked cast warnings, unchecked method invocation warnings, unchecked parameterized vararg type warnings, and unchecked conversion warnings.
I think the unchecked cast warning will be thrown if the compiler cannot verify the type. So what's the difference between cast and conversion? And if there any documents about warnings in Java for reference?
Thanks in advance
专注分享java语言的经验与见解,让所有开发者获益!
评论