Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JDK7: new features related to type variables?

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?

like image 910
java.is.for.desktop Avatar asked Nov 28 '10 23:11

java.is.for.desktop


2 Answers

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.

like image 51
Alex Miller Avatar answered Oct 24 '22 13:10

Alex Miller


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.

like image 44
Jason S Avatar answered Oct 24 '22 12:10

Jason S