Unchecked cast warning vs Unchecked conversion warning, what's the difference between them?

huangapple 未分类评论49阅读模式
英文:

Unchecked cast warning vs Unchecked conversion warning, what's the difference between them?

问题

在《Effective Java》一书中,我发现有未经检查的强制转换警告和未经检查的转换警告。
> 当您使用泛型进行编程时,您会看到许多编译器警告:未经检查的强制转换警告、未经检查的方法调用警告、未经检查的参数化可变参数类型警告以及未经检查的转换警告。

我认为如果编译器无法验证类型,将会抛出未经检查的强制转换警告。那么在强制转换和转换方面有什么区别呢?还有关于 Java 警告的参考文档吗?

提前感谢您的回答 Unchecked cast warning vs Unchecked conversion warning, what's the difference between them?

英文:

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 Unchecked cast warning vs Unchecked conversion warning, what's the difference between them?

huangapple
  • 本文由 发表于 2020年5月3日 14:07:08
  • 转载请务必保留本文链接:https://java.coder-hub.com/61570309.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定