Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ


Choose your language

InfoQ Homepage News Eclipse Code Recommenders goes Crowd with 2.0

Eclipse Code Recommenders goes Crowd with 2.0

This item in japanese

Today at EclipseCon, Codetrails announced the release of Code Recommenders 2.0. The Code Recommenders project grew out of a assist developers when working with unfamiliar or poorly documented APIs. Code Recommenders 1.0, which shipped as part of the Eclipse Juno release train, does so by analysing code frequency patterns and presenting this information to the developers.

The first release had an embedded corpus of knowledge about the core Java libraries and various Eclipse open-source libraries. This knowledge base allows, for example, for intelligent code completion that suggests the methods most relevant to you in current context.

swtTextWidget = new Text(container, SWT.NONE);
  • setLayoutData(Object layoutData) : void – Control – 80%
  • setText(String string) : void – Control – 53%
  • addModifyListener(ModifyListener listener) : void – Text – 38%

Code Recommenders automatically downloads its knowledge base piecemeal from the Eclipse servers whenever you use a supported API (like SWT in the above example).

The codebase of Code Recommenders 1.0 was heavily wired into Eclipse UI code, which made it difficult to use outside of the Eclipse IDE. This is no longer the case with the 2.0 release, which has refactored out the recommendation engine from the Eclipse-specific UI components. Integration still appears in a similar way in Eclipse's UI, but the tool can also be run in a headless mode, e.g. to generate annotated JavaDoc documentation:

protected Control createDialogArea(Composite parent)

Creates and returns the contents of the upper part of this dialog (above the button bar).

See: Subclasses that override createDialogArea also frequently override:

  • configureShell(Shell): 63%
  • okPressed(): 51%


Another innovation built on top of 2.0 is a new context-sensitive recommender, which takes into account the name of the method in which code completion is triggered. For example, insider a setter or create method, the getText() method of SWT's Text class is more likely to be called than dispose(). In a method called dispose() method, the most likely method to be called on Text is dispose(). By picking the first word (using lowerCamelCase) from the enclosing method context, the recommendation's accuracy can be improved.

An incubating project, Snipmatch, provides a means to share snippets with other users and have them shared in a central location. This isn't part of the 2.0 release but is relatively stable, and will likely be folded into future releases.

Building on top of the 2.0 release, Codetrails Connect adds Crowd support. This allows library analysis to be shared with other team members using a private server or with the community at large using a public server. In the latter case, you can precisely specify which code completion events (sent when a user chooses a code completion from the drop-down list) are sent based on a list of white-listed packages. The default list includes various open-source libraries for which events are shared with the community:

  • android*
  • java.*
  • javafx.*
  • javax.*
  • org.apache.*
  • org.eclipse.*
  • org.jboss.*
  • org.w3c.*
  • org.xml.*

As a result, using the Codetrails Connect plug-in should not expose any private or internal code paths to the community server. Alternatively, you can use a private server, hosted by Codetrails, in which case you can share everything with your team members, of course.

A standalone library called ControlFlow Miner can analyse existing compiled codebases and provide its recommendations to be used for organisations who wish to host their own server; the Code Trails company offer several plans which provide the use of a private server. In the future, other languages may be supported with the Codetrails Connect plug-in.

Code Recommenders 2.0 can be installed from the Eclipse Marketplace or from the update site. For more information about Codetrails Connect or the ControlFlow service, see the Codetrails website.

Rate this Article