开发者

JDK7: new features related to type variables?

开发者 https://www.devze.com 2023-01-27 21:24 出处:网络
I remember to hav开发者_开发问答e read about a new feature of JDK7 (now also supported by the Netbeans editor, yet only in current trunk builds).

I remember to hav开发者_开发问答e 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?


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.


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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消