Eclipse 3.8 and 4.2 M5 - New and Noteworthy

Here are some of the more noteworthy things available in milestone build M5 (January 27, 2012) which is now available for download. Unless otherwise indicated, all entries listed here are available in both the 3.8 and 4.2 development streams.

JDT
Null analysis for fields JDT can now raise null related errors/warnings for fields. You can configure null analysis for fields in Preferences > Java > Compiler > Errors/Warnings > Null analysis.

Errors/Warnings preference page with 'Include fields in null analysis' highlighted

With this option enabled, you will be able to see null related errors/warnings on fields, configured using the options Null Pointer access, Potential null pointer access and Redundant null check. Some examples are given below
  • Null pointer access warning

    null pointer access warning on dereferencing a constant field with a null value

  • Potential null pointer access warnings

    potential null pointer access warning on a field that may be null

    Note that in the above case, the field field1 is considered only potentially null because it may be modified in other threads

    potential null pointer access warning on a constant field that may be null

  • Redundant null check warnings

    redundant null check warning on comparing a constant field with a null value against null

    redundant null check warning on comparing a constant field with a non-null value against non-null

    always false null comparison warning on comparing a constant field with a null value against non-null

    redundant instanceof warning on a constant field with a null value

This option can be enabled for the command line batch compiler using the -warn:+nullFields option.

Batch compiler options for using null annotations You can now configure the batch compiler to use annotations for null analysis by passing the token nullAnnot(nullable|nonnull|nonnullbydefault) to the -warn option, where nullable, nonnull and nonnullbydefault are the fully qualified names of the annotation types to be used for null analysis. You can use nullAnnot alone to use JDT's default annotations.

In addition, you can use the -nonNullByDefault token to globally use nonnull as the default when annotation-based null analysis is enabled. This implies that all types in method signatures without a null annotation are considered as specified non-null.

Smarter resource leak detection JDT now performs smarter analysis so that resource leak related errors/warnings (configured by the options Resource leak and Potential resource leak in Preferences > Java > Compiler > Errors/Warnings > Potential programming problems) are no longer reported on practically unimportant cases. Some examples where the absence of a close() call does not trigger any error/warning are given below:
  • Resource-less implementors of Closeable, such as StringReader.

    no resource leak reported if resource-less implentor of Closeable is not closed

  • Wrapping implementors of Closeable, such as BufferedReader, that simply wrap a resource-less Closeable, directly or indirectly.

    no resource leak reported when a resource which wraps a resource-less implentor of Closeable is not closed

  • Wrapped resources where any resource in the chain is (potentially) closed.

    potential resource leak reported when any resource in the chain of wrapper resources is closed along some execution path.

Encoding for source attachments You can now specify the encoding for source attachments for libraries e.g. in Build Path > Libraries > expand the library > Source attachment > Edit...

Dialog to specify encoding for source attachments.

Faster search with pre-built indexes Note: This feature is mainly intended for plug-ins that implement their own classpath container, not for the end user.

You can now tell JDT search to use pre-built indexes instead of having the compiler generate the indexes the first time a JAR is added to the classpath. This prevents indexing from occurring on the user's machine and lets the user obtain first search results faster.

You can specify the index file as a classpath attribute IClasspathAttribute.INDEX_LOCATION_ATTRIBUTE_NAME of the library.

See Help > JDT Plug-in Developer Guide > Programmer's Guide > JDT Core > Indexes for the Java search for more details.

Export detail formatters Detail formatters can now be exported as separate preferences. Previously the only way to share detail formatters was to export all of your workspace settings.

Detail formatters in the export dialog

JDT Debug requires a 1.5 EE JDT Debug has been moved up to now require a 1.5 execution environment
Platform
Shared area tab navigation (4.2 only) Navigation arrows have been introduced to the sides of the shared area to allow you to click and view the tabs that are to the left and right of the currently selected tab. This is the default setting on new installations. Switching to the Classic theme from the preferences (Preferences > General > Appearance) will allow you to bring back the MRU behaviour from 3.x. The MRU behaviour can also be toggled on and off via CSS by setting the mru-visible attribute of an MPartStack to true or false.

This is a preliminary form of the feature and your feedback would be most appreciated.

The shared area with left and right navigation
        arrows on its sides.

Improved editing of environment variables In 3.8M5, editing multi-line environment variables became much simpler with a new UI that presents the variables in a scrolling text widget. The new UI can be found in the edit dialog for a multi-line environment variable on the Environment tab of a supporting launch configuration.

New edit dialog for multi-line environment variables

PDE
Tracing preference page A new preference page is available to dynamically set the debug tracing options for Eclipse. You can turn on individual tracing options and the changes will take effect immediately. There is no need to restart Eclipse.

Tracing preference page

To add a plug-in's tracing options to the page, you must provide an org.eclipse.ui.trace.traceComponents extension. Your bundle must also register an org.eclipse.osgi.service.debug.DebugOptionsListener to be notified when tracing options are changed.

The preference page can be included in other products. It is contained in the org.eclipse.ui.trace plug-in and has no dependencies on PDE.

Non *.jar plug-ins in target platform The target platform will now recognize archive files with any file extension as long as they contain a manifest with the necessary OSGi headers. Previously, PDE only supported directory plug-ins and jarred (*.jar) plug-ins.
Equinox
Customize storage for preference scopes When defining your own preference scope, you can now extend a simple storage customization class rather than implementing all the preference logic yourself. In this class you simply define the code to read and write a preference node to whatever backing store you want to use. This makes it very easy to define a custom preference scope with alternate storage requirements. For more details see the documentation for the org.eclipse.equinox.preferences.preferences extension point, or the new API class org.eclipse.core.runtime.preferences.AbstractPreferenceStorage.

The above features are just the ones that are new since the previous milestone build. Summaries for earlier Juno milestone builds: