Eclipse 3.8 and 4.2 M4 - New and Noteworthy

Here are some of the more noteworthy things available in milestone build M4 (December 9, 2011) 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. See the build notes for details about bugs fixed and other changes.

JDT
Javadoc hover shows parameter annotations Javadoc hovers now render the annotations on method parameters:

org.eclipse.User.User(@NonNull String name, int uid, @Nullable String email)

Annotation-based null analysis JDT can now be configured to use annotations designated as null annotations to perform enhanced inter-procedural null analysis. This feature can be enabled in Preferences > Java > Compiler > Errors/Warnings > Null analysis:

Errors/Warnings preference page with 'Enable annotation-based null analysis' highlighted

You can use either the default annotations bundled with JDT or use your own annotations as null annotations. In addition to enabling the null analysis, the annotations need to be on the Java build path of your project. The default annotations can be found in the org.eclipse.jdt.annotation JAR in the plugins directory, which can be consumed as an OSGi bundle or plain JAR.

When annotation-based null analysis is enabled, JDT issues new diagnostics based on the nullness of a variable or a method return type as specified by a null annotation.

	public void foo(@NonNull Object o1) {
		System.out.println(o1.toString()); // OK: o1 cannot be null
	}
	
	@NonNull Object bar(@Nullable String s1) {
		foo(null); // cannot pass null argument
		@NonNull String s= null; // cannot assign null value 
		@NonNull String t= s1; // cannot assign potentially null value 
		return null; // cannot return null value
	}

Similar diagnostics are also elicited when the value assigned/returned may potentially be null or has unknown nullness.

Overriding methods are also checked for correctness:

class Base {
	@NonNull Object method(@Nullable Object o) {
		return new Object();
	}
}

class Sub extends Base {
	@Override            // method parameter must allow null
	@Nullable Object method(@NonNull Object o) {
		return new Object();
	}
}

You can also use the @NonNullByDefault annotation to set a global default on an element (package, type, method) for all enclosed elements.

@NonNullByDefault
class MyClass {
	// redundant @NonNull annotations:
	public @NonNull Object foo(@NonNull Object o) {
		return o;
	}
	
	@NonNullByDefault(false) // cancels the default
	Object bar(@NonNull Object o) {
		return o;
	}
}

As a result of annotating method signatures, the existing intra-procedural null analysis has even more information because of user-specified annotations and thus provides better results. In the example below, the compiler would not have been able to evaluate the null status of parameter 'obj' without the null annotation.

public void foo(@NonNull Object obj) {
		if (obj == null) { }
	}

Note: This is the first version of this feature. We are working on making this easier to consume in Java project setups, and we will also add quick fixes. The implemented features are complete and tested, but e.g. support for annotating fields or APIs from third-party libraries is currently missing.

PDE
Custom target locations You can now provide custom locations for target definitions. They appear in both the target definition editor and wizard along with the platform provided target locations: directory, installation, feature and software site.

To provide a custom location, you must implement ITargetLocation and extend the extension point org.eclipse.pde.core.targetLocations. To provide labels, wizards and other user interface elements, you must extend an additional extension point org.eclipse.pde.ui.targetLocationProvisioners and have your ITargetLocation implementation adapt to several types. For additional details, view the Javadoc on ITargetLocation.

Platform
Tree Cursor The new TreeCursor class can be used to enable users to navigate a Tree control's individual cells, similar to what TableCursor makes possible for Table controls. For an example of using TreeCursor see Snippet360.

Tree Cursor

VoiceOver context menu On Mac, you can now use the keyboard to open a context menu when VoiceOver is running, using the standard VoiceOver key sequence Control+Option+Shift+M.
Shortcut for context menu on the Mac Shift+F10 now also opens the context menu on the Mac, like it already works on most other platforms. The key binding of the new Show Context Menu command can be configured on the General > Keys preference page.

Screenshot of a context menu in the Synchronize view

Filters in CVS Sync View You can now use regular expressions to filter out changes in the CVS Synchronize view. To enable filters go to Preferences > General > Team > CVS > Synchronize/Compare, uncheck Only look at timestamps to detect changes and enter your regex pattern in the Regular expression to ignore changes in synchronizations field. Each difference in a change is checked against the pattern and is considered as matched, if either left or right side of the difference matches. If all diffs in a file match, the file is excluded from the view.

Preferences for filters in CVS Sync View

Flexible viewer refactored The code driving the debug views (Debug, Variables and Breakpoints) has been substantially refactored to improve its overall quality, stability and performance.

Some of the more notable changes include:
  • There is a 30% improvement in the overall performance of the views
  • Two new interfaces have been added to the provisional API: IModelProxyFactory2 and ITreeModelViewer
  • The Copy and Find actions have been re-written to work better with the virtual views
  • A new viewer filter extension has been added to TreeModelViewerFilter, mitigating scrollbar presentation issues
The complete list of changes can be found here.
Welcome is back (4.2 only) As we progress towards release, the number of missing bits of Eclipse functionality in Eclipse 4.x continue to shrink. For this milestone we've done the preliminary work on both the Capabilities / Activities implementation as well as re-enabling the Welcome (aka "Intro") screen.

This is a major milestone for 4.2 since these were the last two major functional areas which were missing compared to the 3.x stream. With three remaining milestones to fix and polish it looks like we're in good shape for Juno.

NOTE: The first time you start up M4 (even on an existing workspace) you will see the Welcome screen. This is not a defect; it's just the first time that the 'Intro' code has been run on that workspace. If you have more than one perspective open, you'll also notice there is a layout problem that will be addressed in the next milestone. In either case you can just close or un-maximize the Welcome view to get back to normal.

Welcome perspective in Eclipse 4.2

Refactored Eclipse 4 Event API (4.2 only) Workbench UI events have been refactored to make them easier to understand and use. For a detailed write up on the Eclipse 4 event model and the changes in this release please take a look at http://wiki.eclipse.org/Eclipse4/RCP/Event_Model and http://wiki.eclipse.org/Eclipse4/UI/Event/Migration.
Equinox
Update to Jetty 8 and Servlet 3.0 The Equinox HTTP service implementation is now using Jetty 8.1 as the web container to support Servlet 3.0 and JSP 2.2. The Equinox HTTP service is required to host the Eclipse user assistence web context for serving up help content.

For the Juno release, Equinox will no longer support the use of older Jetty implementations and we are no longer shipping Jetty 6. The Equinox HTTP service implementation will no longer work with the Servlet 2.5 and JSP 2.1 APIs. Also note that the Jasper and expresson language implementation bundles have changed in order to support the Servlet 3.0 and JSP 2.2 specifications. The following bundles have been removed:

  • org.apache.jasper
  • org.apache.commons.el
  • org.mortbay.jetty.server
  • org.mortbay.jetty.util
These have been replaced with the following to support Servlet 3.0 and JSP 2.2:
  • org.eclipse.jetty.continuation
  • org.eclipse.jetty.http
  • org.eclipse.jetty.io
  • org.eclipse.jetty.security
  • org.eclipse.jetty.server
  • org.eclipse.jetty.servlet
  • org.eclipse.jetty.util
  • javax.el
  • org.apache.jasper.glassfish
  • com.sun.el