Geertjan is a DZone Zone Leader and has posted 437 posts at DZone. You can read more from them at their website. View Full User Profile

JDK 7 Support in NetBeans IDE 7.0

11.10.2010
| 21532 views |
  • submit to reddit

In the upcoming NetBeans IDE 7.0, the user will be able to select JDK 7 as a project's target platform. If this is done, the built-in parser starts using the new compiler (no red underlines for new javac features) and the following set of IDE features are enabled:

  • Strings in switch
  • Diamond operator (new LinkedList<>())
  • java.util.Objects
  • JSR 292 (Exotic identifiers)
  • Multicatch
  • Automatic resource management
  • New parser

Details on each of the above are found below:

Strings in switch
  • code completion updated
  • hint converting a cascade of if-elses to switch

Switch-screenshot.png

Diamond operator (new LinkedList<>())
  • warning when the diamond operator is not used and could be, includes fix to remove the superfluous bounds
  • tooltip in hyperlink (Ctrl-point to the identifier) shows inferred bounds

Diamon-screenshot.png

java.util.Objects
  • equals and hashcode generator (Alt-Insert, "equals() and hashCode()") uses java.util.Objects.equals/hashCode if available

JSR 292 (Exotic identifiers)
  • exotic identifiers supported in semantic highlighting, mark occurrences and Go to Declaration
  • suggestion to convert an integer constant to a different radix can also convert to binary literal

Multicatch
  • code completion works in the multicatch variable declaration
  • hint to join multiple catches into one multicatch if the handling code is the same
  • fix for the error if the multicatch variable is not final

Multicatch-screenshot.png

Automatic resource management
  • convert to ARM hint

Arm-screenshot.png

New parser

As mentioned, the built-in parser recognizes the new syntax. In the following screenshot, all the hints from the previous screenshots have been applied to yield the final result:

After-screenshot.png

From http://wiki.netbeans.org/NewAndNoteworthyNB70

 

Published at DZone with permission of its author, Geertjan Wielenga.

Comments

Adrian Milliner replied on Thu, 2010/11/11 - 9:17am

Will the Netbeans editor recognise JLS3.3 unicode escapes in 7.0? Eg.
void \uu0070() {
}
is perfectly valid but not recognised by 7M2 (nor IDEA 9/10, but is by Eclipse 3.6)

Martin Wildam replied on Mon, 2010/11/15 - 4:30am

Personally I find, that the most important new features made it into 7 - at least what my requirements are.

Can't wait for 7...

Eamonn McManus replied on Mon, 2010/11/15 - 6:54am

This is really excellent! Of course, it will probably need some tweaks as the finest details of the changes are settled. For example, a change that is in the pipeline will remove the requirement to declare a multicatch variable final, so the fix for that case will no longer be necessary.

Marcelo Kobs replied on Mon, 2010/11/15 - 9:32am

finnaly Strings in switch  :)

that is awesome i really love it. 

i cant wait :( 

Shoaib Abdullah replied on Mon, 2010/12/27 - 1:58am

It is perhaps require some tweaks as the nice details of the changes are settled. A change that is in the pipeline will remove the requirement to declare a multicatch variable final. interior design get paid to online

Matt Coleman replied on Thu, 2012/10/18 - 1:40am in response to: Shoaib Abdullah

I agree...a bit of tweaking is need

what to buy a graphic designer 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.