2. 2
The following is intended to outline our general
product direction. It is intended for information
purposes only, and may not be incorporated into any
contract. It is not a commitment to deliver any
material, code, or functionality, and should not be
relied upon in making purchasing decisions.
The development, release, and timing of any features
or functionality described for Oracle’s products
remains at the sole discretion of Oracle.
8. 8
Project Coin
Small (Language) Changes
openjdk.java.net/projects/coin
●
Diamond
●
Try-with-resources
●
Improved integral Literals
●
Strings in switch
●
Varargs warnings
●
Multi-catch & precise rethrow
●
Joe Darcy -
http://blogs.sun.com/darcy
coin, n. A piece of small change
coin, v. To create a new language
9. 9
Evolving the Language
From “Evolving the Java Language” - JavaOne 2005
• Java language principles
– Reading is more important than writing
– Code should be a joy to read
– The language should not hide what is happening
– Code should do what it seems to do
– Simplicity matters
– Every “good” feature adds more “bad” weight
– Sometimes it is best to leave things out
• One language: with the same meaning everywhere
– No dialects
Also see “Growing a Language” - Guy Steele 1999
10. 10
Evolving the Language
From “Evolving the Java Language” - JavaOne 2005
• We will evolve the Java Language
- but cautiously, with a long term view
– We want Java to be around in 2030
– We can't take a slash and burn approach
– “first do no harm”
• We will add a few select features periodically
– Aimed at developer productivity
– While preserving clarity and simplicity
11. 11
Project Coin Constraints
• Small language changes
– Small in specification, implementation, testing
– No new keywords!
– Wary of type system changes
• Coordinate with larger language changes
– Project Lambda
– Modularity
• One language, one javac
12. 12
Better Integer Literal
• Binary literals
• With underscores for clarity
int mask = 0b101010101010;
int mask = 0b1010_1010_1010;
long big = 9_223_783_036_967_937L;
13. 13
String in Switch
int monthNameToDays(String s, int year) {
switch(s) {
case "April": case "June":
case "September": case "November":
return 30;
case "January": case "March":
case "May": case "July":
case "August": case "December":
return 31;
case "February":
...
default:
...
15. 15
• Pre generics
• With generics
List strList = new ArrayList();
List<String> strList = new ArrayList<String>();
List<Map<String, List<String>> strList =
new ArrayList<Map<String, List<String>>();
16. 16
Diamond
• Pre generics
• With generics
• With diamond (<>) to infer the type
List strList = new ArrayList();
List<String> strList = new ArrayList<String>();
List<Map<String, List<String>> strList =
new ArrayList<Map<String, List<String>>();
List<String> strList = new ArrayList<>();
List<Map<String, List<String>> strList =
new ArrayList<>();
21. 21
Project Lambda
Closures and more
openjdk.java.net/projects/lambda
●
Lambda expressions
●
SAM conversion with target typing
●
Method references
●
Library enhancements for internal iteration
●
Default methods for interface evolution
●
Brian Goetz - @BrianGoetz
●
Alex Buckley - http://blogs.sun.com/abuckley
22. 22
Motivation for Lambda Project
• Moore's law, multi core chip
• Library is one of Java's key
strength
– Better libraries are key to making
parallelization better
• Higher level operations tend to
improve readability of code as
well as performance
• Without more language
support for parallel idioms,
people will instinctively reach
for serial idioms
23. 23
UltraSPARC T1
( Niagara 1 (2005) )
8 x 4 = 32
UltraSPARC T2
( Niagara 2 (2007) )
8 x 8 = 64
UltraSPARC T3
( Rainbow Falls )
16 x 8 = 128
24. 24
For loop – External Iteration
• Code is inherently serial
– Iterate through students serially
– Stateful – use of > and highestScore
– External iteration – client of students determines iteration
mechanism
double highestScore = 0.0;
for (Student s : students) {
if ((s.gradYear == 2010)
&& (s.score > highestScore))
highestScore = s.score;
}
25. 25
Hypothetical Internal Iteration
• Not inherently serial
– students traversal not determined by developer
– Looks like a functional language
• Anonymous inner class!
double highestScore = students
.filter(new Predicate<Student>() {
public boolean isTrue(Student s) {
return s.gradYear == 2010;
}})
.map(new Extractor<Student,Double>() {
public Double extract(Student s) {
return s.score;
}})
.max();
26. 26
Introducing Lambda Expressions
• Lambda expressions introduced with #
– Signal to the JVM to defer execution of the code
– Body may be an expression
• Lambda expression are not syntactic sugar for
anonymous inner class
– Implemented with MethodHandle from JSR-292
double highestScore = students
.filter(#{ Student s -> s.gradYear == 2010 })
.map(#{ Student s -> s.score })
.max();
27. 27
The DaVinci Machine Project
JSR 292
A multi-language renaissance for the JVM
openjdk.java.net/projects/mlvm
●
Dynamic Invocation
- InvokeDynamic bytecode
●
Method Handles
●
Tail Calls
●
Tuples
●
Continuations
●
Interface Injection ...
●
John Rose -
http://blogs.sun.com/jrose
33. 33
Project Jigsaw
Modularity in the Java platform
openjdk.java.net/projects/jigsaw
●
Module System for JDK
●
Mark Reinhold
http://blogs.sun.com/mr
●
Alex Buckley
http://blogs.sun.com/abuckley
34. 34
Problems
• Application construction, packaging and publication
– “JAR Hell”
• Performance
– Download time
– Startup time
• Platform scalability
– Down to small devices
35. 35
Solution – The Modular Java Platform
• Enables escape from “JAR Hell”
– Eliminates class path
– Package modules for automatic download & install
– Generate native packages – deb, rpm, ips, etc
• Enables significant performance improvements
– Incremental download → fast classloading
– Optimise module content during installation
• Platform scalability – down to small devices
– Well-specified SE subsets can fit into small devices
44. 44
JVM Convergence
●
Two mainstream JVMs
●
HotSpot
●
Versatile (client and server), market share leader, high
quality and performance
●
JRockit
●
Specialized for the Oracle server stack, basis of value-adds
like Mission Control, Virtual Edition and Soft Real-Time
●
Wasteful to continue development on both, so
●
Goal: Single JVM incorporating best features
45. 45
JVM Convergence
●
More engineers working on HotSpot so..
●
Converged JVM based on HotSpot
with all goodness from JRockit
●
Open-sourced via OpenJDK
●
Some value-add such as Mission Control will remain proprietary
●
Free binary download includes closed source goodies
●
Same use license as before
●
Oracle committed to continued investment
●
JVM teams have been merged, working on feature transfer
●
And moving forward on new projects
●
Will be a multi-year process