Java 8 represents one of the biggest Java releases ever. This provides API designers with the facilities to create better interfaces with stricter rules about what can be passed to and returned from an API. The JDT will provide compile time type checking to ensure this constraint holds. For example, you can specify that a List should never be null, and each element of the list should also never be null. Features such as default methods (method bodies in your interfaces), better type inference and effectively final variables are all supported:įinally, Java 8 supports type annotations and Eclipse ships with a set of annotations for null analysis. While lambda support was clearly the most visible change in Java 8, there are a number of other features too. The debugger supports breakpoints in lambdas as well as the variable view, and stack frame inspection:
Simple enable this, and select Source -> Clean Up to automatically update your current code to use lambdas. There are Code Formatter options for lambda expressions such as ones that describe how the expression should be wrapped:Īnd code clean-up actions which will convert the uses of anonymous classes to lambdas where possible. functional interfaces) to a lambda expression:Īs well as ones for converting back, or even changing the body expression to a block (ctrl+1): There are quick-fixes, for converting anonymous inner classes (with a single method - i.e. The Eclipse Java Compiler (EJC) now supports Java 8 and the tools are well integrated. New and Noteworthyįor those of you who were not lucky enough to join us in San Francisco, here is a summary of the Eclipse Support for Java 8.
For details about how to get Java 8 support in Eclipse, please read to the bottom of this post. Java 8 is available as an update for Eclipse Kepler (2013 Release) and is now available nightly / integration builds towards Eclipse Luna (2014 Release). Highlights for me included hearing Alex Buckley describe the Road to Lambda, listening to John Arthorne talk about API Design in Java 8 and watching the Eclipse Java Development Tools (JDT) Team present all the great work they did on Java 8 Tooling in Eclipse. To help celebrate the launch, we had an entire Java 8 Day at EclipseCon 2014, which included sessions from both Java and Eclipse engineers. Last week Java 8 was launched and moments later the Eclipse support for Java 8 was announced.