Over a million developers have joined DZone.
Platinum Partner

JDK 7 Support in NetBeans IDE 7.0

· Java Zone

Discover how AppDynamics steps in to upgrade your performance game and prevent your enterprise from these top 10 Java performance problems, brought to you in partnership with AppDynamics.

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

File: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

File: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

File:Multicatch-screenshot.png

Automatic resource management

  • convert to ARM hint

File: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:

File:After-screenshot.png

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

 

The Java Zone is brought to you in partnership with AppDynamics. AppDynamics helps you gain the fundamentals behind application performance, and implement best practices so you can proactively analyze and act on performance problems as they arise, and more specifically with your Java applications. Start a Free Trial.

Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}