JDK7:与类型变量相关的新功能?
我记得读过 JDK7 的一项新功能(现在 Netbeans 编辑器也支持,但仅在当前的主干版本中)。
当编写 instanceof SomeClass
时没有类型变量时,这个微小的功能将不再产生警告。
这个功能如何称呼?
有人知道任何参考文献,在哪里描述它吗?
最重要:JDK7 中是否还有其他与类型变量相关的更改?
I remember to have read about a new feature of JDK7 (now also supported by the Netbeans editor, yet only in current trunk builds).
This tiny feature wouldn't produce a warning anymore when instanceof SomeClass<?>
is written without the type variable.
How is this feature it called?
Do someone know any reference, where it is described?
Most important: are there other changes in JDK7 related to type variables?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我相信您正在谈论简化的 Varargs 方法调用提案< /a> 来自鲍勃·李。这是一个硬币提案,现在包含在 Java 7 的 JSR 334 中(JSR 336)。
我知道的唯一其他更改是改进 的类型推断通用实例创建(钻石) 更改。
I believe you are speaking of the Simplified Varargs Method Invocation proposal from Bob Lee. It was a coin proposal and is now included in JSR 334 for Java 7 (JSR 336).
The only other change I know of is the Improved Type Inference for Generic Instance Creation (diamond) change.
<>
的使用称为“通用实例创建的改进类型推断”或“钻石”模式,它是 Project Coin。尽管您的问题 (
instanceof SomeClass<>
) 听起来略有不同。The use of
<>
is called the "Improved Type Inference for Generic Instance Creation" or "diamond" pattern, and it is part of Project Coin.Although your issue (
instanceof SomeClass<>
) sounds slightly different.可能与coin项目及其在处理泛型时改进的类型推断有关,看看此处。这似乎不是确切的功能,只是相关的东西。
Maybe it is related to project coin and its improved type inference when dealing with generics, take a look here. It doesn't seem the exact feature thou, just something related.