JDK7:与类型变量相关的新功能?

发布于 2024-10-05 02:01:54 字数 283 浏览 3 评论 0原文

我记得读过 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

情域 2024-10-12 02:01:54

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.

梅窗月明清似水 2024-10-12 02:01:54

<> 的使用称为“通用实例创建的改进类型推断”或“钻石”模式,它是 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.

只怪假的太真实 2024-10-12 02:01:54

可能与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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文