Here are descriptions of some of the more interesting or significant changes made to the Java development tools for the Luna (4.4) release of Eclipse. They are grouped into:
See also the Eclipse Platform What's New document for changes in the Platform.
Java Editor |
|
Quick fix to change project compliance and JRE to 1.8 | A quick fix Change project compliance and JRE to 1.8 is provided to quickly change the current project to be compatible with Java 8. |
Migrate anonymous class creations to lambda expressions and back |
You can convert anonymous class creations to lambda expressions (and back) by invoking the Quick Assists (Ctrl+1):
Before: After the Quick Assist (Ctrl+1), the 6 lines are condensed into 1: Or invoke Source > Clean Up..., use a custom profile, and on the Configure... dialog select Convert functional interface instances and Use lambda where possible on the Code Style tab. |
Change lambda expression body block to expression and back |
You can convert the body of a lambda expression from block to expression (and back) by invoking the Quick Assists (Ctrl+1):
|
View the method implemented by the functional interface instances |
To view the method implemented by the functional interface instances, you can hover on:
|
Navigate to the functional method declaration |
To navigate to the functional method declaration, hold Ctrl,
move the mouse pointer over '-> ' or ':: ', and click the hyperlink.
|
Quick Fixes to create 'for' loops |
A set of new quick fixes can create for loops that iterate over a given expression.
For arrays:
Collection s:
List s:
|
Enabled coloring of variables | Parameter variables and local variables are now colored by default: This can be disabled or configured with different colors and styles on the Java > Editor > Syntax Coloring preference page. |
Java Formatter |
|
Option to control lambda code formatting |
New options are provided in the formatter page to configure the formatting of lambda expressions.
Formatter profiles can be configured on the Java > Code Style > Formatter preference page. |
Java Compiler |
|
Java 8 | Java™ 8 is here, and JDT fully supports it. The Eclipse compiler for Java (ECJ) implements all the new Java 8 language enhancements. |
Option to control generation of method parameter attributes in class files | In 1.8 compliance mode, you can enable the generation of method parameter attributes in class files: |
Contributed VMs are more recognizable |
You can't remove VMs that have been contributed to Eclipse via the org.eclipse.jdt.launching.vmInstalls extension point.This
fact is now more recognizable:
|
Null type annotations |
With the advent of "type annotations" as introduced in Java 8 via JSR 308, JDT takes null pointer analysis to the next level.
This feature requires a set of nullness annotations declared with With these annotations, nullness can be considered as an intrinsic part of the type system, allowing the compiler to perform null type checking along with each task of type checking. This is a major step towards systematically detecting all possible NullPointerExceptions in a program. The most obvious benefit is in annotating type arguments of generic types:
The example shows diverse usage of null-annotated type arguments.
While most of the code has been checked to be safe, the compiler directly points out
one obvious bug:
In this variant an error is detected by recognizing that For a comprehensive description of type annotation based null analysis see the online help.
While potentially, the new approach could lead to an explosion of the number of annotations,
also
The
In line 27 all null-defaults are canceled for the scope of method |
Migrating projects using null annotations for use in Luna |
The switch from declaration annotations (Java 5) to null type annotations (Java 8)
brings a few unavoidable incompatibilities. Developers already using null annotations
are advised to carefully read the compatibility notes.
Main points to observe:
|
ECJ requires 1.6 JRE | The JDT Core project has moved to Java 1.6 compliance level. This means the command line compiler now requires JRE 1.6 or above to run. |
A man page is available for ECJ batch compiler |
A UNIX like man page is available for the batch compiler. This man page essentially lists down the options and the corresponding usage information as found in this
section.
Information in the man file can be read by the command "man <path_to_ecj.1>" in command prompt mode. |
Java Views and Dialogs |
|
Option to fine-grain Java search to limit to method reference expressions |
The Java search for method and constructor can now be limited to method reference expressions.
This option can be configured by clicking the hyperlink next to Search > Java Search > Limit To > Match locations: |
Debug |
|
Java 8 debug support |
Java Debugger has been enhanced to support Java 8 key features like:
|
Improved HCR for member types |
Hot Code Replace (HCR) has been improved in the Java debugger to ensure the correct method is dropped to
in member types (inner / anonymous / local classes).
For more information see the bugzilla entry. |
JUnit |
|
Failure trace font for the JUnit view | The font for the failure trace in the JUnit view is now configurable on the General > Appearance > Colors and Fonts preference page. |