KEY2215_Ma-2013-JavaOne-Shanghai-Technical

Download Report

Transcript KEY2215_Ma-2013-JavaOne-Shanghai-Technical

Java SE
Simon Ritter
Java Technology Ambassador
@speakjava
1
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
JDK 8 in the works
• JDK 7 shipped in July 2011
• JDK 8 scheduled to ship in 2014
•
Expecting a 2-year cadence between platform releases going forward
•
Java SE 8 platform under JSR 336
• Major features planned for JDK 8
2
•
Lambda expressions and default methods (JSR 335)
•
Annotation-related language changes (JSR 308)
•
Date and Time API (JSR 310)
•
Compact Profiles
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
JDK 8
Innovation
Java for Everyone
Client
• Lambda aka Closures
• Language Interop
• Nashorn
•
•
•
•
•
•
•
•
•
•
•
•
•
Core Libraries
• Parallel operations for core
collections APIs
• Improvements in functionality
• Improved type inference
General Goodness
• JVM enhancements
• No PermGen limitations
• Performance lmprovements
3
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Profiles for constrained devices
JSR 310 - Date & Time APIs
Non-Gregorian calendars
Unicode 6.2
ResourceBundle.
BCP47 locale matching
Globalization & Accessibility
Tools
• Compiler control & logging
• JSR 308 - Annotations on
Java Type
• Native app bundling
• App Store Bundling tools
Deployment enhancements
JavaFX 8
Java SE Embedded support
Enhanced HTML5 support
3D shapes and attributes
Printing
Security
•
•
•
•
•
Limited doPrivilege
NSA Suite B algorithm support
SNI Server Side support
DSA updated to FIPS186-3
AEAD JSSE CipherSuites
The road of closures in Java
• In 2006-2008, a vigorous community debate about closures
• Multiple proposals, including BGGA , CICE, and FCM
• December 2009 – OpenJDK Project Lambda formed
• November 2010 – JSR-335 filed
•
Current status
• Draft specification available
• Prototype (source and binary) available on OpenJDK
• Coming soon to mainline JDK 8 builds
4
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Coordinated Platform Upgrade with Lambda
• Language
• Lambda Expressions (closures)
• Interface Evolution with default methods
• Libraries
• Bulk data operations on Collections
• More library support for parallelism
• JVM
• Default methods
• Enhancements to invokedynamic
5
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Let us look at some code
Robust error handling in a scheduling application
// Event handler for when things go terribly wrong
filterTask.setOnFailed(new EventHandler<WorkerStateEvent>()
{
@Override public void handle(WorkerStateEvent e) {
e.getSource().getException().printStackTrace();
}
});
// Event handler for when things go terribly wrong
filterTask.setOnFailed(
e -> e.getSource().getException().printStackTrace());
6
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
for (Shape s : shapes) {
if (s.getColor() == BLUE)
s.setColor(RED);
}
shapes.forEach(s -> {
if (s.getColor() == BLUE)
s.setColor(RED);
});
7
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Extension Methods
interface Collection<T> {
default void forEach(Block<T> action) {
for (T t : this)
action.apply(t);
}
// Rest of Collection methods…
}
8
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Project Lambda
• Lambda expressions + extension methods allow:
• Internal iteration
• Bulk data operations for existing types
• Better support for parallelism leveraging fork/join
9
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Project
Nashorn
10
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.
Test Pilots Wanted
• Developer Preview available
•
Schedule on: http://openjdk.java.net/projects/jdk8
•
Contribute to OpenJFX: http://openjdk.java.net/projects/openjfx
• JDK 8 builds with many features already available
11
•
Try out Lambda and check out JavaFX 8: http://jdk8.java.net
•
Participate in the JCP for free through your local JUG
•
Jigsaw builds also available from Java.net
Copyright © 2013, Oracle and/or its affiliates. All rights reserved.