Poster presented on "Eclipse and Java 8" at the Grace Hopper Celebration of Women in Computing India (Bangalore) 2013 (a program of the Anita Borg Institute, co-presented with the Association for Computing Machinery).
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
Eclipse and Java 8 - GHC 2013 Poster
1. Eclipse is a free and open source development platform comprising of
extensible frameworks, tools and runtimes.
The Eclipse Java development tools (JDT) project contributes an extensible
full-featured Java IDE to the Eclipse platform. It is considered by many to be
the best Java development tool available.
The next iteration of the Java language i.e. Java 8 is currently scheduled for
general availability in March 2014.
JDT will provide a feature patch for Eclipse Kepler SR2 (4.3.2) and ship Java 8
support with the next Eclipse release i.e. Eclipse Luna (4.4).
Project Lambda – Interface Improvements
Default Methods
- Problem: Evolve interfaces without introducing incompatibility with
existing implementations.
Standard Java libraries need new lambda-friendly methods.
- Solution: Default methods – means of API evolution
Static Methods
Project Lambda
- Problem:
Functional Interfaces
- Interfaces that define a single abstract method.
- Optionally capture the design intent with @FunctionalInterface annotation.
- Example: Common callback interfaces like Runnable and Comparator.
A common scenario – Java libraries having companion utility
classes with static methods.
- Solution: Static methods – allow helper methods specific to an interface to
live with the interface.
Type Annotations
Lambda Expressions
- A lambda expression is used to implement a functional interface, without
creating a class or an anonymous class.
- Before Java 8: Annotations could only be applied to declarations.
- As of Java 8: Annotations can also be applied anywhere you use a type!
- Problem: “Tiny anonymous classes” used in callbacks, runnables, event
handlers, comparators etc.
All we need!
- Solution:
Lambda Expression!
Reduced runtime overhead compared to anonymous classes!
- Syntax: (formal parameter list) { expression or statements }
Concise syntax compared to anonymous classes!
Declaration Annotation
Type Use Annotation
Supports improved analysis of Java programs.
Enables checker frameworks and static analysis tools such as Sonar and
FindBugs.
- In
Java 8, it is permitted to explicitly declare the method receiver as the
first formal parameter. The only purpose of writing the receiver explicitly is
to make it possible to annotate the receiver’s type.
Method References
- Problem: A lambda expression that just invokes a named method.
- Solution: Further simplify the implementation of functional interface by using
a shorthand for lambda – method reference of the existing named method.
Join the Eclipse open source community and its large ecosystem of projects:
http://www.eclipse.org/
- Forums: http://www.eclipse.org/forums
- Bugzilla: http://bugs.eclipse.org/bugs/
- Contributing to JDT/UI: http://wiki.eclipse.org/JDT_UI/How_to_Contribute
Noopur Gupta (noopur_gupta@in.ibm.com)
Eclipse JDT/UI Committer
IBM Software Lab, Bangalore