SlideShare ist ein Scribd-Unternehmen logo
1 von 65
Downloaden Sie, um offline zu lesen
Thursday, December 8, 2011
<Insert Picture Here>

Java SE 7: The Platform Evolves
JUG Lausanne, November 30th, 2011
Dalibor Topic
Java F/OSS Ambassador

Thursday, December 8, 2011
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.

Thursday, December 8, 2011
Audience Survey
• Downloaded JDK 7 GA or 7u1?
• Using it?
• Download a JDK 7 Mac OS X Port - Developer

•
•
•
•
•
•

Preview Release build?
• http://jdk7.java.net/macportpreview
Subscribed to an OpenJDK mailing list like jdk7u-dev?
Contributed to OpenJDK?
• http://openjdk.java.net/contribute
Following @OpenJDK on Twitter?
Following @Java on Twitter?
Listening to Java Spotlight podcast?
Subscribed to Java Magazine?
4

Thursday, December 8, 2011
Priorities for the Java Platforms
Grow Developer Base
Grow Adoption
Increase Competitiveness
Adapt to change

Thursday, December 8, 2011
Java Communities

Thursday, December 8, 2011
How Java Evolves and Adapts

Community Development of
Java Technology
Specifications

Thursday, December 8, 2011
Java Community Process 2.8
• Expert Group transparency
• EG must do all substantive business on a public mailing list
• EG must track issues in a public issue tracker
• EG must respond publicly to all comments

• Executive Committee transparency
• EC must hold public meetings and teleconferences, and publish minutes
• EC must provide a public mailing list for JCP member feedback

• TCK and License transparency
• TCK licensing must permit public discussion of testing process and results
• Spec Lead cannot withdraw a spec/RI/TCK license once offered

Thursday, December 8, 2011
Java Community Process 2.8
• Participation
• EG nominations and Spec Lead responses must be public
• EG members are identified by name and company

• Agility
• JSRs must reach Early Draft Review within nine months
• JSRs must reach Public Review within 12 months after EDR
• JSRs must reach Final Release within 12 months after PR
• Faster and simpler Maintenance Releases

• JCP 2.8 is mandatory for new JSRs, and in-flight JSRs are
encouraged to adopt it

Thursday, December 8, 2011
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

• We will evolve the Java language
• But cautiously, with a long term view
• “first do no harm”
also “Growing a Language” - Guy Steele 1999
“The Feel of Java” - James Gosling 1997
10
Thursday, December 8, 2011
So you want to change the language?

11
Thursday, December 8, 2011
Java SE 7 Release Contents
• Java Language
•

Project Coin (JSR-334)

• Class Libraries
•
•

NIO2 (JSR-203)
Fork-Join framework, ParallelArray (JSR-166y)

• Java Virtual Machine
•
•

The DaVinci Machine project (JSR-292)
InvokeDynamic bytecode

• Miscellaneous things
• JSR-336: Java SE 7 Release Contents

12
Thursday, December 8, 2011
Small
Language
Changes

<Insert Picture Here>

Section Divider

Project Coin
13
Thursday, December 8, 2011
coin, n. A piece of small change
coin, v. To create new language

14
Thursday, December 8, 2011
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

15
Thursday, December 8, 2011
Better Integer Literal
• Binary literals

int mask = 0b101010101010;

• With underscores for clarity

int mask = 0b1010_1010_1010;
long big = 9_223_783_036_967_937L;

16
Thursday, December 8, 2011
String Switch Statement
• Today case label includes integer constants and
enum constants
• Strings are constants too (immutable)

17
Thursday, December 8, 2011
Discriminating Strings Today
int monthNameToDays(String s, int year) {
if("April".equals(s) || "June".equals(s) ||
"September".equals(s) ||"November".equals(s))
return 30;
if("January".equals(s) || "March".equals(s) ||
"May".equals(s) || "July".equals(s) ||
"August".equals(s) || "December".equals(s))
return 31;
if("February".equals(s))
...

18
Thursday, December 8, 2011
Strings in Switch Statements
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:
...
19
Thursday, December 8, 2011
Simplifying Generics
• Pre-generics
List strList = new ArrayList();

20
Thursday, December 8, 2011
Simplifying Generics
• Pre-generics
List strList = new ArrayList();
• With Generics
List<String> strList = new ArrayList<String>();

21
Thursday, December 8, 2011
Simplifying Generics
• Pre-generics
List strList = new ArrayList();
• With Generics
List<String> strList = new ArrayList<String>();
List<Map<String, List<String>> strList =
new ArrayList<Map<String, List<String>>();

22
Thursday, December 8, 2011
Diamond Operator
• Pre-generics
List strList = new ArrayList();
• With Generics
List<String> strList = new ArrayList<String>();
List<Map<String, List<String>> strList =
new ArrayList<Map<String, List<String>>();

• With diamond (<>) compiler infers type
List<String> strList = new ArrayList<>();
List<Map<String, List<String>> strList =
new ArrayList<>();

23
Thursday, December 8, 2011
Copying a File
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dest);
byte[] buf = new byte[8192];
int n;
while (n = in.read(buf)) >= 0)
out.write(buf, 0, n);

24
Thursday, December 8, 2011
Copying a File (Better, but wrong)
InputStream in = new FileInputStream(src);
OutputStream out = new FileOutputStream(dest);
try {
byte[] buf = new byte[8192];
int n;
while (n = in.read(buf)) >= 0)
out.write(buf, 0, n);
} finally {
in.close();
out.close();
}

25
Thursday, December 8, 2011
Copying a File (Correct, but complex)
InputStream in = new FileInputStream(src);
try {
OutputStream out = new FileOutputStream(dest);
try {
byte[] buf = new byte[8192];
int n;
while (n = in.read(buf)) >= 0)
out.write(buf, 0, n);
} finally {
out.close();
}
} finally {
in.close();
}

26
Thursday, December 8, 2011
Copying a File (Correct, but complex)
InputStream in = new FileInputStream(src);
try {
OutputStream out = new FileOutputStream(dest);
try {
byte[] buf = new byte[8192];
int n;
while (n = in.read(buf)) >= 0)
out.write(buf, 0, n);
} finally {
out.close();
}
} finally {
Exception thrown from
in.close();
potentially three places.
}
Details of first two could be lost

27
Thursday, December 8, 2011
Automatic Resource Management
try (InputStream in = new FileInputStream(src),
OutputStream out = new FileOutputStream(dest))
{
byte[] buf = new byte[8192];
int n;
while (n = in.read(buf)) >= 0)
out.write(buf, 0, n);
}

28
Thursday, December 8, 2011
The Details
• Compiler desugars try-with-resources into nested tryfinally blocks with variables to track exception state
• Suppressed exceptions are recorded for posterity
using a new facillity of Throwable
• API support in JDK 7
• New superinterface java.lang.AutoCloseable
• All AutoCloseable and by extension java.io.Closeable
types useable with try-with-resources
• anything with a void close() method is a candidate
• JDBC 4.1 retrefitted as AutoCloseable too

29
Thursday, December 8, 2011
More Informative Backtraces
java.io.IOException
at Suppress.write(Suppress.java:19)
at Suppress.main(Suppress.java:8)
Suppressed: java.io.IOException
at Suppress.close(Suppress.java:24)
at Suppress.main(Suppress.java:9)
Suppressed: java.io.IOException
at Suppress.close(Suppress.java:24)
at Suppress.main(Suppress.java:9)

30
Thursday, December 8, 2011
Varargs Warnings
class Test {
public static void main(String... args) {
List<List<String>> monthsInTwoLanguages =
Arrays.asList(Arrays.asList("January",
"February"),
Arrays.asList("Gennaio",
"Febbraio" ));
}
}
Test.java:7: warning:
[unchecked] unchecked generic array creation
for varargs parameter of type List<String>[]
Arrays.asList(Arrays.asList("January",
^
1 warning

31
Thursday, December 8, 2011
Varargs Warnings Revised
• New mandatory compiler warning at suspect varargs
method declarations
• By applying an annotation at the declaration,
warnings at the declaration and call sites can be
suppressed
• @SuppressWarnings(value = “unchecked”)
• @SafeVarargs

32
Thursday, December 8, 2011
Exceptions Galore
try {
...
} catch(ClassNotFoundException cnfe) {
doSomethingClever(cnfe);
throw cnfe;
} catch(InstantiationException ie) {
log(ie);
throw ie;
} catch(NoSuchMethodException nsme) {
log(nsme);
throw nsme;
} catch(InvocationTargetException ite) {
log(ite);
throw ite;
}

33
Thursday, December 8, 2011
Multi-Catch
try {
...
} catch (ClassCastException e) {
doSomethingClever(e);
throw e;
} catch(InstantiationException |
NoSuchMethodException |
InvocationTargetException e) {
log(e);
throw e;
}

34
Thursday, December 8, 2011
35
Thursday, December 8, 2011
New I/O 2 (NIO2) Libraries
JSR 203

• Original Java I/O APIs presented challenges for
developers
•
•
•
•

Not designed to be extensible
Many methods do not throw exceptions as expected
rename() method works inconsistently
Developers want greater access to file metadata

• Java NIO2 solves these problems

36
Thursday, December 8, 2011
Java NIO2 Features
• Path is a replacement for File
• Biggest impact on developers

• Better directory support
• list() method can stream via iterator
• Entries can be filtered using regular expressions in API

• Symbolic link support
• java.nio.file.Filesystem
• interface to a filesystem (FAT, ZFS, Zip archive, network, etc)

• java.nio.file.attribute package
• Access to file metadata

37
Thursday, December 8, 2011
Path Class
• Equivalent of java.io.File in the new API
– Immutable
• Have methods to access and manipulate Path
• Few ways to create a Path
– From Paths and FileSystem
//Make a reference to the path
Path home = Paths.get(“/home/fred”);
//Resolve tmp from /home/fred -> /home/fred/tmp
Path tmpPath = home.resolve(“tmp”);
//Create a relative path from tmp -> ..
Path relativePath = tmpPath.relativize(home)
File file = relativePath.toFile();

38
Thursday, December 8, 2011
File Operation – Copy, Move
• File copy is really easy
– With fine grain control
Path src = Paths.get(“/home/fred/readme.txt”);
Path dst = Paths.get(“/home/fred/copy_readme.txt”);
Files.copy(src, dst,
StandardCopyOption.COPY_ATTRIBUTES,
StandardCopyOption.REPLACE_EXISTING);

• File move is supported
– Optional atomic move supported
Path src = Paths.get(“/home/fred/readme.txt”);
Path dst = Paths.get(“/home/fred/readme.1st”);
Files.move(src, dst, StandardCopyOption.ATOMIC_MOVE);

39
Thursday, December 8, 2011
Directories
• DirectoryStream iterate over entries
– Scales to large directories
– Uses less resources
– Smooth out response time for remote file systems
– Implements Iterable and Closeable for productivity
• Filtering support
– Build-in support for glob, regex and custom filters
Path srcPath = Paths.get(“/home/fred/src”);
try (DirectoryStream<Path> dir =
srcPath.newDirectoryStream(“*.java”)) {
for (Path file: dir)
System.out.println(file.getName());
}

40
Thursday, December 8, 2011
Concurrency APIs
• JSR166y
• Update to JSR166x which was an update to JSR166

• Adds a lightweight task framework
• Also referred to as Fork/Join

• Phaser
• Barrier similar to CyclicBarrier and CountDownLatch

• TransferQueue interface
• Extension to BlockingQueue
• Implemented by LinkedTransferQueue

41
Thursday, December 8, 2011
Fork Join Framework
• Goal is to take advantage of multiple processor
• Designed for task that can be broken down into

smaller pieces
– Eg. Fibonacci number fib(10) = fib(9) + fib(8)

• Typical algorithm that uses fork join

if I can manage the task
perform the task
else
fork task into x number of smaller/similar task
join the results

42
Thursday, December 8, 2011
Key Classes
• ForkJoinPool
– Executor service for running ForkJoinTask
• ForkJoinTask
– The base class for forkjoin task
• RecursiveAction
– A subclass of ForkJoinTask
– A recursive resultless task
– Implements compute() abstract method to perform
calculation
• RecursiveTask
– Similar to RecursiveAction but returns a result

43
Thursday, December 8, 2011
ForkJoin Example – Fibonacci
public class Fibonacci extends RecursiveTask<Integer> {
private final int number;
public Fibonacci(int n) { number = n; }

}

@Override protected Integer compute() {
switch (number) {
case 0: return (0);
case 1: return (1);
default:
Fibonacci f1 = new Fibonacci(number – 1);
Fibonacci f2 = new Fibonacci(number – 2);
f1.fork(); f2.fork();
return (f1.join() + f2.join());
}
}

44
Thursday, December 8, 2011
ForkJoin Example – Fibonacci
ForkJoinPool pool = new ForkJoinPool();
Fibonacci r = new Fibonacci(10);
pool.submit(r);
while (!r.isDone()) {
//Do some work
...
}
System.out.println("Result of fib(10) = "
+ r.get());

45
Thursday, December 8, 2011
Client Libraries
•
•
•
•

Nimbus Look and Feel
Platform APIs for shaped and translucent windows
JLayer (formerly from Swing labs)
Optimised 2D rendering

46
Thursday, December 8, 2011
Nimbus Look and Feel
• Better than Metal for cross platform look-and-feel
• Introduced in Java SE 6u10, now part of Swing
• Not the default L&F

47
Thursday, December 8, 2011
JLayer component
Easy enrichment for Swing components

48
Thursday, December 8, 2011
The DaVinci Machine Project (JSR-292)
(A multi-language renaissance for the JVM)

Better

49
Thursday, December 8, 2011
Languages Like Virtual Machines
• Programming languages need runtime support
•
•
•
•
•
•

Memory management / Garbage collection
Concurrency control
Security
Reflection
Debugging integration
Standard libraries

• Compiler writers have to build these from scratch
• Targeting a VM allows reuse of infrastructure

50
Thursday, December 8, 2011
JVM Specification

“The Java virtual machine knows
nothing about the Java
programming language, only of a
particular binary format, the class
file format.”
1.2 The Java Virtual Machine Spec.

51
Thursday, December 8, 2011
Languages Running on the JVM
Zigzag

Icon

Rexx

Tcl

CAL

Nice
Simkin

Eiffel

Groovy

Tiger
E

JESS

Modula-2

Correlate

Tea
Jickle

Prolog

Mini

Drools
v-language

Anvil

Smalltalk

Tiger
Ada
G
Clojure
Dawn
Processing
WebL
LLP
BeanShell
Forth

Jython

Yoix

Pascal Luck

PLAN

Yassl

C#

JavaScript

Basic JudoScript

JavaFX Script

Logo

Lisp

iScript

Hojo

Funnel

Oberon
FScript

JHCR
Scheme

JRuby

Phobos

TermWare

PHP

Scala

Pnuts

Sather
Sleep
Bex Script

SALSA ObjectScript
Piccola
51

52
Thursday, December 8, 2011
InvokeDynamic Bytecode
• JVM currently has four ways to invoke method
• Invokevirtual, invokeinterface, invokestatic, invokespecial

• All require full method signature data
• InvokeDynamic will use method handle
• Effectively an indirect pointer to the method

• When dynamic method is first called bootstrap code
determines method and creates handle
• Subsequent calls simply reference defined handle
• Type changes force a re-compute of the method
location and an update to the handle
• Method call changes are invisible to calling code

53
Thursday, December 8, 2011
CallSite and MethodHandle
• invokedynamic linked to a CallSite
– CallSite can be linked or unlinked
– CallSite holder of MethodHandle
• MethodHandle is a directly executable reference to

an underlying method, constructor, field

– Can transform arguments and return type
– Transformation – conversion, insertion, deletion, substitution

54
Thursday, December 8, 2011
invokedynamic Illustrated
this[method_name](x, y)
invokedynamic
[#bootstrapMethod]
.this_method_name

1. Invoke bootstrap

2. Produces
CallSite

3.Complete linkage

CallSite

4. Invokes method
implementation

class LangaugeRuntime {
bootstrapMethod(info) {
...
return new CallSite();
}

class AClass {
aMethod(x, y) {
Method
...
Handle }

55
Thursday, December 8, 2011
Miscellaneous Things
• Security
• Eliptic curve cryptography
• TLS 1.2

•
•
•
•
•
•

JAXP 1.4.4
JAX-WS 2.2
JAXB 2.2
ClassLoader architecture changes
close() for URLClassLoader
Javadoc support for CSS

56
Thursday, December 8, 2011
JDK 7 Platform Support
• Windows x86

• Server 2008, Server 2008 R2, 7 & 8 (when it GAs)
• Windows Vista, XP

• Linux x86
•
•
•
•

Oracle Linux 5.5+, 6.x
Red Hat Enterprise Linux 5.5+, 6.x
SuSE Linux Enterprise Server 10.x, 11.x
Ubuntu Linux 10.04 LTS, 11.04

• Solaris x86/SPARC
• Solaris 10.9+, 11.x

• Apple OSX x86

• will be supported post-GA, detailed plan TBD

Note: JDK 7 should run on pretty much any Windows/Linux/Solaris.
These configurations are the ones primarily tested by Oracle, and
for which we provide commercial support.

57
Thursday, December 8, 2011
JVM Convergence – Forward looking
Project “HotRockit”
JDK 7 GA – 07/11

JDK 7u2

JDK 7uX

JDK 8 GA

• Hotspot 21

• Hotspot 22

• Hotspot 23

• Hotspot24

• Java SE 7 Support

• Performance

• More performance

• Java SE 8 Support

• Rebranding

• Enable large heaps

• Improved command

• All performance

• Improved JMX

Agent
• Command line
servicability tool
(jrcmd)

--- Premium --• Improved JRockit
Mission Control
Console support

Thursday, December 8, 2011

with reasonable
latencies

line servicability
(jcmd)
• Enable large heaps
with consistent
reasonable latencies
• No PermGen
--- Premium --• Complete JRockit
Flight Recorder
Support

features from
JRockit ported
• All servicability
features from
JRockit ported
• Compiler controls
• Verbose logging
--- Premium --• JRockit Mission
Control Memleak
Tool Support
• Soft Real Time GC
JDK Roadmap

JDK 7u6
NetBeans 7
• Java SE 7
support
• more

JDK 7u2
JDK 7

• JRE 7 on java.com
• JavaFX 2.0 co-install

2011

Last public
JDK 6 update

• OS X JRE port
(for end-users)
• Improved OS
integration, autoupdate

NetBeans.next
• Java SE 8 support
• JavaFX 3.0 support
• more

2013

2012

2014

Mac OS X

JDK 7u4

JDK 8

• JDK 7 Dev Preview
• JavaFX 2.0 Dev Preview

• OS X JDK Port (for
developers)

• Windows, Linux, Solaris,
OS X
• Jigsaw
• Lambda
• JavaFX 3.0
• Complete Oracle JVM
convergence
• JavaScript interop
• more

NetBeans 7.1
• JavaFX 2.0 support

Thursday, December 8, 2011
JDK 8 - Summer 2013

• Strong feedback from
community – 2 years
needed between JDK
releases
• Release date revised to
summer 2013 (from late
2012)
• Enables larger scope,
such as:
– Jigsaw – complete platform
modularization, container
support
– Lambda – Bulk operations
– JavaScript Interop
– Device Support

Thursday, December 8, 2011

Theme

Description/Content

Project Jigsaw

EXPANDED

• Module system for Java applications and the Java platform

Project
Lambda

EXPANDED

• Closures and related features in the Java language (JSR 335)
• Bulk parallel operations in Java collections APIs (filter/map/reduce)

Oracle JVM
Convergence

• Complete migration of performance and serviceability features from
JRockit, including Mission Control and the Flight Recorder

JavaFX 3.0

• Next generation Java client

JavaScript

NEW

Device Support

NEW

• Next-gen JavaScript-on-JVM engine (Project Nashorn)
• JavaScript/Java interoperability on JVM
• Multi-Touch (JavaFX), Camera, Location, Compass and Accelerometer

Developer Productivity

• Annotations on types (JSR 308), Minor language enhancements

API and Other Updates

• Enhancements to Security, Date/Time, (JSR 310) Networking,
Internationalization, Accessibility, Packaging/Installation

Open Source

• Open development in OpenJDK, open source additional closed
components
JDK Enhancement Proposal (JEP) Process
• “A process for collecting, reviewing, sorting, and recording the
results of proposals for enhancements to the JDK”
• Goal: Produce a regularly-updated list of proposals to serve as
the long-term Roadmap for JDK Release Projects
• Looks at least three years into the future to allow time for the
most complex proposals to be defined and implemented
• Open to every OpenJDK Committer
• Does not in any way supplant the Java Community Process

Thursday, December 8, 2011
JEPs as of 11/11/11 (11:11:11)
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•
•

1
2
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126

Thursday, December 8, 2011

JDK Enhancement-Proposal & Roadmap Process
JEP Template
Generalized Target-Type Inference
Process API Updates
Parallel Array Sorting
Annotations on Java Types
DocTree API
Add Javadoc to javax.tools
Bulk Data Operations for Collections
Collections Enhancements from Third-Party Libraries
Enhance Core Libraries with Lambda
New HTTP Client
Additional Unicode Constructs for Regular Expressions
Charset Implementation Improvements
MS-SFU Kerberos 5 Extensions
TLS Server Name Indication (SNI) Extension
AEAD CipherSuites
Extended Validation Certificates
Remove the Annotation-Processing Tool (apt)
Access to Parameter Names at Runtime
javax.lang.model Implementation Backed by Core Reflection
Repeating Annotations
Stronger Algorithms for Password-Based Encryption
Remove the Permanent Generation
Configurable Secure Random-Number Generation
Enhance the Certificate Revocation-Checking API
Network Interface Aliases, Events, and Defaults
Lambda Expressions and Virtual Extension Methods
Conclusions
• Java SE 7
• Incremental changes
• Evolutionary, not revolutionary
• Good solid set of features to make developers life easier

• Java SE 8
• Major new features: Modularisation and Closures
• More smaller features to be defined

• Java continues to grow and adapt to the changing
world of IT

63
Thursday, December 8, 2011
The preceding 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.

64
Thursday, December 8, 2011
65
Thursday, December 8, 2011

Weitere ähnliche Inhalte

Mehr von JUG Lausanne

Introduction aux algorithmes génétiques
Introduction aux algorithmes génétiquesIntroduction aux algorithmes génétiques
Introduction aux algorithmes génétiquesJUG Lausanne
 
Développer un moteur d'exécution symbolique en partant de rien
Développer un moteur d'exécution symbolique en partant de rienDévelopper un moteur d'exécution symbolique en partant de rien
Développer un moteur d'exécution symbolique en partant de rienJUG Lausanne
 
Reverse engineering Java et contournement du mécanisme de paiement inapp Android
Reverse engineering Java et contournement du mécanisme de paiement inapp AndroidReverse engineering Java et contournement du mécanisme de paiement inapp Android
Reverse engineering Java et contournement du mécanisme de paiement inapp AndroidJUG Lausanne
 
Exemple d'IOT et ML avec Android, Cassandra et Spark
Exemple d'IOT et ML avec Android, Cassandra et SparkExemple d'IOT et ML avec Android, Cassandra et Spark
Exemple d'IOT et ML avec Android, Cassandra et SparkJUG Lausanne
 
Spring Batch - Julien Jakubowski - November 2010
Spring Batch - Julien Jakubowski - November 2010Spring Batch - Julien Jakubowski - November 2010
Spring Batch - Julien Jakubowski - November 2010JUG Lausanne
 
Infinispan - Galder Zamarreno - October 2010
Infinispan - Galder Zamarreno - October 2010Infinispan - Galder Zamarreno - October 2010
Infinispan - Galder Zamarreno - October 2010JUG Lausanne
 
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010JUG Lausanne
 
Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010JUG Lausanne
 
Introduction Groovy / Grails - Cyril Picat - December 2009
Introduction Groovy / Grails - Cyril Picat - December 2009Introduction Groovy / Grails - Cyril Picat - December 2009
Introduction Groovy / Grails - Cyril Picat - December 2009JUG Lausanne
 
Initiation aux tests fonctionnels - Philippe Kernevez - October 2009
Initiation aux tests fonctionnels - Philippe Kernevez - October 2009Initiation aux tests fonctionnels - Philippe Kernevez - October 2009
Initiation aux tests fonctionnels - Philippe Kernevez - October 2009JUG Lausanne
 
Sonar - Freddy Mallet - April 2009
Sonar - Freddy Mallet - April 2009Sonar - Freddy Mallet - April 2009
Sonar - Freddy Mallet - April 2009JUG Lausanne
 
Maven2 - Philippe Kernevez - March 2009
Maven2 - Philippe Kernevez - March 2009Maven2 - Philippe Kernevez - March 2009
Maven2 - Philippe Kernevez - March 2009JUG Lausanne
 
Introduction à Google Web Toolkit (GWT) - Philippe Kernevez - February 2009
Introduction à Google Web Toolkit (GWT) - Philippe Kernevez - February 2009Introduction à Google Web Toolkit (GWT) - Philippe Kernevez - February 2009
Introduction à Google Web Toolkit (GWT) - Philippe Kernevez - February 2009JUG Lausanne
 
XML & Java - Raphaël Tagliani - March 2008
XML & Java - Raphaël Tagliani - March 2008XML & Java - Raphaël Tagliani - March 2008
XML & Java - Raphaël Tagliani - March 2008JUG Lausanne
 
Visual Mobile Applications with Netbeans 6.0 - Cédric Tabin - February 2008
Visual Mobile Applications with Netbeans 6.0 - Cédric Tabin - February 2008Visual Mobile Applications with Netbeans 6.0 - Cédric Tabin - February 2008
Visual Mobile Applications with Netbeans 6.0 - Cédric Tabin - February 2008JUG Lausanne
 
Scripting with Java FX - Cédric Tabin - December 2007
Scripting with Java FX - Cédric Tabin - December 2007Scripting with Java FX - Cédric Tabin - December 2007
Scripting with Java FX - Cédric Tabin - December 2007JUG Lausanne
 
GlassFish Update and Directions - Karim Mazouni - November 2007
GlassFish Update and Directions - Karim Mazouni - November 2007GlassFish Update and Directions - Karim Mazouni - November 2007
GlassFish Update and Directions - Karim Mazouni - November 2007JUG Lausanne
 
JUG Launch - Cédric Tabin - September 2007
JUG Launch - Cédric Tabin - September 2007JUG Launch - Cédric Tabin - September 2007
JUG Launch - Cédric Tabin - September 2007JUG Lausanne
 
NetBeans 5.5 and Java EE - Cédric Tabin - June 2007
NetBeans 5.5 and Java EE - Cédric Tabin - June 2007NetBeans 5.5 and Java EE - Cédric Tabin - June 2007
NetBeans 5.5 and Java EE - Cédric Tabin - June 2007JUG Lausanne
 

Mehr von JUG Lausanne (19)

Introduction aux algorithmes génétiques
Introduction aux algorithmes génétiquesIntroduction aux algorithmes génétiques
Introduction aux algorithmes génétiques
 
Développer un moteur d'exécution symbolique en partant de rien
Développer un moteur d'exécution symbolique en partant de rienDévelopper un moteur d'exécution symbolique en partant de rien
Développer un moteur d'exécution symbolique en partant de rien
 
Reverse engineering Java et contournement du mécanisme de paiement inapp Android
Reverse engineering Java et contournement du mécanisme de paiement inapp AndroidReverse engineering Java et contournement du mécanisme de paiement inapp Android
Reverse engineering Java et contournement du mécanisme de paiement inapp Android
 
Exemple d'IOT et ML avec Android, Cassandra et Spark
Exemple d'IOT et ML avec Android, Cassandra et SparkExemple d'IOT et ML avec Android, Cassandra et Spark
Exemple d'IOT et ML avec Android, Cassandra et Spark
 
Spring Batch - Julien Jakubowski - November 2010
Spring Batch - Julien Jakubowski - November 2010Spring Batch - Julien Jakubowski - November 2010
Spring Batch - Julien Jakubowski - November 2010
 
Infinispan - Galder Zamarreno - October 2010
Infinispan - Galder Zamarreno - October 2010Infinispan - Galder Zamarreno - October 2010
Infinispan - Galder Zamarreno - October 2010
 
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
 
Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010Introduction à Scala - Michel Schinz - January 2010
Introduction à Scala - Michel Schinz - January 2010
 
Introduction Groovy / Grails - Cyril Picat - December 2009
Introduction Groovy / Grails - Cyril Picat - December 2009Introduction Groovy / Grails - Cyril Picat - December 2009
Introduction Groovy / Grails - Cyril Picat - December 2009
 
Initiation aux tests fonctionnels - Philippe Kernevez - October 2009
Initiation aux tests fonctionnels - Philippe Kernevez - October 2009Initiation aux tests fonctionnels - Philippe Kernevez - October 2009
Initiation aux tests fonctionnels - Philippe Kernevez - October 2009
 
Sonar - Freddy Mallet - April 2009
Sonar - Freddy Mallet - April 2009Sonar - Freddy Mallet - April 2009
Sonar - Freddy Mallet - April 2009
 
Maven2 - Philippe Kernevez - March 2009
Maven2 - Philippe Kernevez - March 2009Maven2 - Philippe Kernevez - March 2009
Maven2 - Philippe Kernevez - March 2009
 
Introduction à Google Web Toolkit (GWT) - Philippe Kernevez - February 2009
Introduction à Google Web Toolkit (GWT) - Philippe Kernevez - February 2009Introduction à Google Web Toolkit (GWT) - Philippe Kernevez - February 2009
Introduction à Google Web Toolkit (GWT) - Philippe Kernevez - February 2009
 
XML & Java - Raphaël Tagliani - March 2008
XML & Java - Raphaël Tagliani - March 2008XML & Java - Raphaël Tagliani - March 2008
XML & Java - Raphaël Tagliani - March 2008
 
Visual Mobile Applications with Netbeans 6.0 - Cédric Tabin - February 2008
Visual Mobile Applications with Netbeans 6.0 - Cédric Tabin - February 2008Visual Mobile Applications with Netbeans 6.0 - Cédric Tabin - February 2008
Visual Mobile Applications with Netbeans 6.0 - Cédric Tabin - February 2008
 
Scripting with Java FX - Cédric Tabin - December 2007
Scripting with Java FX - Cédric Tabin - December 2007Scripting with Java FX - Cédric Tabin - December 2007
Scripting with Java FX - Cédric Tabin - December 2007
 
GlassFish Update and Directions - Karim Mazouni - November 2007
GlassFish Update and Directions - Karim Mazouni - November 2007GlassFish Update and Directions - Karim Mazouni - November 2007
GlassFish Update and Directions - Karim Mazouni - November 2007
 
JUG Launch - Cédric Tabin - September 2007
JUG Launch - Cédric Tabin - September 2007JUG Launch - Cédric Tabin - September 2007
JUG Launch - Cédric Tabin - September 2007
 
NetBeans 5.5 and Java EE - Cédric Tabin - June 2007
NetBeans 5.5 and Java EE - Cédric Tabin - June 2007NetBeans 5.5 and Java EE - Cédric Tabin - June 2007
NetBeans 5.5 and Java EE - Cédric Tabin - June 2007
 

Kürzlich hochgeladen

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Kürzlich hochgeladen (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Java 7, or JDK 7 Updates or JDK 8 - Dalibor Topic - December 2011

  • 2. <Insert Picture Here> Java SE 7: The Platform Evolves JUG Lausanne, November 30th, 2011 Dalibor Topic Java F/OSS Ambassador Thursday, December 8, 2011
  • 3. 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. Thursday, December 8, 2011
  • 4. Audience Survey • Downloaded JDK 7 GA or 7u1? • Using it? • Download a JDK 7 Mac OS X Port - Developer • • • • • • Preview Release build? • http://jdk7.java.net/macportpreview Subscribed to an OpenJDK mailing list like jdk7u-dev? Contributed to OpenJDK? • http://openjdk.java.net/contribute Following @OpenJDK on Twitter? Following @Java on Twitter? Listening to Java Spotlight podcast? Subscribed to Java Magazine? 4 Thursday, December 8, 2011
  • 5. Priorities for the Java Platforms Grow Developer Base Grow Adoption Increase Competitiveness Adapt to change Thursday, December 8, 2011
  • 7. How Java Evolves and Adapts Community Development of Java Technology Specifications Thursday, December 8, 2011
  • 8. Java Community Process 2.8 • Expert Group transparency • EG must do all substantive business on a public mailing list • EG must track issues in a public issue tracker • EG must respond publicly to all comments • Executive Committee transparency • EC must hold public meetings and teleconferences, and publish minutes • EC must provide a public mailing list for JCP member feedback • TCK and License transparency • TCK licensing must permit public discussion of testing process and results • Spec Lead cannot withdraw a spec/RI/TCK license once offered Thursday, December 8, 2011
  • 9. Java Community Process 2.8 • Participation • EG nominations and Spec Lead responses must be public • EG members are identified by name and company • Agility • JSRs must reach Early Draft Review within nine months • JSRs must reach Public Review within 12 months after EDR • JSRs must reach Final Release within 12 months after PR • Faster and simpler Maintenance Releases • JCP 2.8 is mandatory for new JSRs, and in-flight JSRs are encouraged to adopt it Thursday, December 8, 2011
  • 10. 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 • We will evolve the Java language • But cautiously, with a long term view • “first do no harm” also “Growing a Language” - Guy Steele 1999 “The Feel of Java” - James Gosling 1997 10 Thursday, December 8, 2011
  • 11. So you want to change the language? 11 Thursday, December 8, 2011
  • 12. Java SE 7 Release Contents • Java Language • Project Coin (JSR-334) • Class Libraries • • NIO2 (JSR-203) Fork-Join framework, ParallelArray (JSR-166y) • Java Virtual Machine • • The DaVinci Machine project (JSR-292) InvokeDynamic bytecode • Miscellaneous things • JSR-336: Java SE 7 Release Contents 12 Thursday, December 8, 2011
  • 13. Small Language Changes <Insert Picture Here> Section Divider Project Coin 13 Thursday, December 8, 2011
  • 14. coin, n. A piece of small change coin, v. To create new language 14 Thursday, December 8, 2011
  • 15. 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 15 Thursday, December 8, 2011
  • 16. Better Integer Literal • Binary literals int mask = 0b101010101010; • With underscores for clarity int mask = 0b1010_1010_1010; long big = 9_223_783_036_967_937L; 16 Thursday, December 8, 2011
  • 17. String Switch Statement • Today case label includes integer constants and enum constants • Strings are constants too (immutable) 17 Thursday, December 8, 2011
  • 18. Discriminating Strings Today int monthNameToDays(String s, int year) { if("April".equals(s) || "June".equals(s) || "September".equals(s) ||"November".equals(s)) return 30; if("January".equals(s) || "March".equals(s) || "May".equals(s) || "July".equals(s) || "August".equals(s) || "December".equals(s)) return 31; if("February".equals(s)) ... 18 Thursday, December 8, 2011
  • 19. Strings in Switch Statements 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: ... 19 Thursday, December 8, 2011
  • 20. Simplifying Generics • Pre-generics List strList = new ArrayList(); 20 Thursday, December 8, 2011
  • 21. Simplifying Generics • Pre-generics List strList = new ArrayList(); • With Generics List<String> strList = new ArrayList<String>(); 21 Thursday, December 8, 2011
  • 22. Simplifying Generics • Pre-generics List strList = new ArrayList(); • With Generics List<String> strList = new ArrayList<String>(); List<Map<String, List<String>> strList = new ArrayList<Map<String, List<String>>(); 22 Thursday, December 8, 2011
  • 23. Diamond Operator • Pre-generics List strList = new ArrayList(); • With Generics List<String> strList = new ArrayList<String>(); List<Map<String, List<String>> strList = new ArrayList<Map<String, List<String>>(); • With diamond (<>) compiler infers type List<String> strList = new ArrayList<>(); List<Map<String, List<String>> strList = new ArrayList<>(); 23 Thursday, December 8, 2011
  • 24. Copying a File InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest); byte[] buf = new byte[8192]; int n; while (n = in.read(buf)) >= 0) out.write(buf, 0, n); 24 Thursday, December 8, 2011
  • 25. Copying a File (Better, but wrong) InputStream in = new FileInputStream(src); OutputStream out = new FileOutputStream(dest); try { byte[] buf = new byte[8192]; int n; while (n = in.read(buf)) >= 0) out.write(buf, 0, n); } finally { in.close(); out.close(); } 25 Thursday, December 8, 2011
  • 26. Copying a File (Correct, but complex) InputStream in = new FileInputStream(src); try { OutputStream out = new FileOutputStream(dest); try { byte[] buf = new byte[8192]; int n; while (n = in.read(buf)) >= 0) out.write(buf, 0, n); } finally { out.close(); } } finally { in.close(); } 26 Thursday, December 8, 2011
  • 27. Copying a File (Correct, but complex) InputStream in = new FileInputStream(src); try { OutputStream out = new FileOutputStream(dest); try { byte[] buf = new byte[8192]; int n; while (n = in.read(buf)) >= 0) out.write(buf, 0, n); } finally { out.close(); } } finally { Exception thrown from in.close(); potentially three places. } Details of first two could be lost 27 Thursday, December 8, 2011
  • 28. Automatic Resource Management try (InputStream in = new FileInputStream(src), OutputStream out = new FileOutputStream(dest)) { byte[] buf = new byte[8192]; int n; while (n = in.read(buf)) >= 0) out.write(buf, 0, n); } 28 Thursday, December 8, 2011
  • 29. The Details • Compiler desugars try-with-resources into nested tryfinally blocks with variables to track exception state • Suppressed exceptions are recorded for posterity using a new facillity of Throwable • API support in JDK 7 • New superinterface java.lang.AutoCloseable • All AutoCloseable and by extension java.io.Closeable types useable with try-with-resources • anything with a void close() method is a candidate • JDBC 4.1 retrefitted as AutoCloseable too 29 Thursday, December 8, 2011
  • 30. More Informative Backtraces java.io.IOException at Suppress.write(Suppress.java:19) at Suppress.main(Suppress.java:8) Suppressed: java.io.IOException at Suppress.close(Suppress.java:24) at Suppress.main(Suppress.java:9) Suppressed: java.io.IOException at Suppress.close(Suppress.java:24) at Suppress.main(Suppress.java:9) 30 Thursday, December 8, 2011
  • 31. Varargs Warnings class Test { public static void main(String... args) { List<List<String>> monthsInTwoLanguages = Arrays.asList(Arrays.asList("January", "February"), Arrays.asList("Gennaio", "Febbraio" )); } } Test.java:7: warning: [unchecked] unchecked generic array creation for varargs parameter of type List<String>[] Arrays.asList(Arrays.asList("January", ^ 1 warning 31 Thursday, December 8, 2011
  • 32. Varargs Warnings Revised • New mandatory compiler warning at suspect varargs method declarations • By applying an annotation at the declaration, warnings at the declaration and call sites can be suppressed • @SuppressWarnings(value = “unchecked”) • @SafeVarargs 32 Thursday, December 8, 2011
  • 33. Exceptions Galore try { ... } catch(ClassNotFoundException cnfe) { doSomethingClever(cnfe); throw cnfe; } catch(InstantiationException ie) { log(ie); throw ie; } catch(NoSuchMethodException nsme) { log(nsme); throw nsme; } catch(InvocationTargetException ite) { log(ite); throw ite; } 33 Thursday, December 8, 2011
  • 34. Multi-Catch try { ... } catch (ClassCastException e) { doSomethingClever(e); throw e; } catch(InstantiationException | NoSuchMethodException | InvocationTargetException e) { log(e); throw e; } 34 Thursday, December 8, 2011
  • 36. New I/O 2 (NIO2) Libraries JSR 203 • Original Java I/O APIs presented challenges for developers • • • • Not designed to be extensible Many methods do not throw exceptions as expected rename() method works inconsistently Developers want greater access to file metadata • Java NIO2 solves these problems 36 Thursday, December 8, 2011
  • 37. Java NIO2 Features • Path is a replacement for File • Biggest impact on developers • Better directory support • list() method can stream via iterator • Entries can be filtered using regular expressions in API • Symbolic link support • java.nio.file.Filesystem • interface to a filesystem (FAT, ZFS, Zip archive, network, etc) • java.nio.file.attribute package • Access to file metadata 37 Thursday, December 8, 2011
  • 38. Path Class • Equivalent of java.io.File in the new API – Immutable • Have methods to access and manipulate Path • Few ways to create a Path – From Paths and FileSystem //Make a reference to the path Path home = Paths.get(“/home/fred”); //Resolve tmp from /home/fred -> /home/fred/tmp Path tmpPath = home.resolve(“tmp”); //Create a relative path from tmp -> .. Path relativePath = tmpPath.relativize(home) File file = relativePath.toFile(); 38 Thursday, December 8, 2011
  • 39. File Operation – Copy, Move • File copy is really easy – With fine grain control Path src = Paths.get(“/home/fred/readme.txt”); Path dst = Paths.get(“/home/fred/copy_readme.txt”); Files.copy(src, dst, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING); • File move is supported – Optional atomic move supported Path src = Paths.get(“/home/fred/readme.txt”); Path dst = Paths.get(“/home/fred/readme.1st”); Files.move(src, dst, StandardCopyOption.ATOMIC_MOVE); 39 Thursday, December 8, 2011
  • 40. Directories • DirectoryStream iterate over entries – Scales to large directories – Uses less resources – Smooth out response time for remote file systems – Implements Iterable and Closeable for productivity • Filtering support – Build-in support for glob, regex and custom filters Path srcPath = Paths.get(“/home/fred/src”); try (DirectoryStream<Path> dir = srcPath.newDirectoryStream(“*.java”)) { for (Path file: dir) System.out.println(file.getName()); } 40 Thursday, December 8, 2011
  • 41. Concurrency APIs • JSR166y • Update to JSR166x which was an update to JSR166 • Adds a lightweight task framework • Also referred to as Fork/Join • Phaser • Barrier similar to CyclicBarrier and CountDownLatch • TransferQueue interface • Extension to BlockingQueue • Implemented by LinkedTransferQueue 41 Thursday, December 8, 2011
  • 42. Fork Join Framework • Goal is to take advantage of multiple processor • Designed for task that can be broken down into smaller pieces – Eg. Fibonacci number fib(10) = fib(9) + fib(8) • Typical algorithm that uses fork join if I can manage the task perform the task else fork task into x number of smaller/similar task join the results 42 Thursday, December 8, 2011
  • 43. Key Classes • ForkJoinPool – Executor service for running ForkJoinTask • ForkJoinTask – The base class for forkjoin task • RecursiveAction – A subclass of ForkJoinTask – A recursive resultless task – Implements compute() abstract method to perform calculation • RecursiveTask – Similar to RecursiveAction but returns a result 43 Thursday, December 8, 2011
  • 44. ForkJoin Example – Fibonacci public class Fibonacci extends RecursiveTask<Integer> { private final int number; public Fibonacci(int n) { number = n; } } @Override protected Integer compute() { switch (number) { case 0: return (0); case 1: return (1); default: Fibonacci f1 = new Fibonacci(number – 1); Fibonacci f2 = new Fibonacci(number – 2); f1.fork(); f2.fork(); return (f1.join() + f2.join()); } } 44 Thursday, December 8, 2011
  • 45. ForkJoin Example – Fibonacci ForkJoinPool pool = new ForkJoinPool(); Fibonacci r = new Fibonacci(10); pool.submit(r); while (!r.isDone()) { //Do some work ... } System.out.println("Result of fib(10) = " + r.get()); 45 Thursday, December 8, 2011
  • 46. Client Libraries • • • • Nimbus Look and Feel Platform APIs for shaped and translucent windows JLayer (formerly from Swing labs) Optimised 2D rendering 46 Thursday, December 8, 2011
  • 47. Nimbus Look and Feel • Better than Metal for cross platform look-and-feel • Introduced in Java SE 6u10, now part of Swing • Not the default L&F 47 Thursday, December 8, 2011
  • 48. JLayer component Easy enrichment for Swing components 48 Thursday, December 8, 2011
  • 49. The DaVinci Machine Project (JSR-292) (A multi-language renaissance for the JVM) Better 49 Thursday, December 8, 2011
  • 50. Languages Like Virtual Machines • Programming languages need runtime support • • • • • • Memory management / Garbage collection Concurrency control Security Reflection Debugging integration Standard libraries • Compiler writers have to build these from scratch • Targeting a VM allows reuse of infrastructure 50 Thursday, December 8, 2011
  • 51. JVM Specification “The Java virtual machine knows nothing about the Java programming language, only of a particular binary format, the class file format.” 1.2 The Java Virtual Machine Spec. 51 Thursday, December 8, 2011
  • 52. Languages Running on the JVM Zigzag Icon Rexx Tcl CAL Nice Simkin Eiffel Groovy Tiger E JESS Modula-2 Correlate Tea Jickle Prolog Mini Drools v-language Anvil Smalltalk Tiger Ada G Clojure Dawn Processing WebL LLP BeanShell Forth Jython Yoix Pascal Luck PLAN Yassl C# JavaScript Basic JudoScript JavaFX Script Logo Lisp iScript Hojo Funnel Oberon FScript JHCR Scheme JRuby Phobos TermWare PHP Scala Pnuts Sather Sleep Bex Script SALSA ObjectScript Piccola 51 52 Thursday, December 8, 2011
  • 53. InvokeDynamic Bytecode • JVM currently has four ways to invoke method • Invokevirtual, invokeinterface, invokestatic, invokespecial • All require full method signature data • InvokeDynamic will use method handle • Effectively an indirect pointer to the method • When dynamic method is first called bootstrap code determines method and creates handle • Subsequent calls simply reference defined handle • Type changes force a re-compute of the method location and an update to the handle • Method call changes are invisible to calling code 53 Thursday, December 8, 2011
  • 54. CallSite and MethodHandle • invokedynamic linked to a CallSite – CallSite can be linked or unlinked – CallSite holder of MethodHandle • MethodHandle is a directly executable reference to an underlying method, constructor, field – Can transform arguments and return type – Transformation – conversion, insertion, deletion, substitution 54 Thursday, December 8, 2011
  • 55. invokedynamic Illustrated this[method_name](x, y) invokedynamic [#bootstrapMethod] .this_method_name 1. Invoke bootstrap 2. Produces CallSite 3.Complete linkage CallSite 4. Invokes method implementation class LangaugeRuntime { bootstrapMethod(info) { ... return new CallSite(); } class AClass { aMethod(x, y) { Method ... Handle } 55 Thursday, December 8, 2011
  • 56. Miscellaneous Things • Security • Eliptic curve cryptography • TLS 1.2 • • • • • • JAXP 1.4.4 JAX-WS 2.2 JAXB 2.2 ClassLoader architecture changes close() for URLClassLoader Javadoc support for CSS 56 Thursday, December 8, 2011
  • 57. JDK 7 Platform Support • Windows x86 • Server 2008, Server 2008 R2, 7 & 8 (when it GAs) • Windows Vista, XP • Linux x86 • • • • Oracle Linux 5.5+, 6.x Red Hat Enterprise Linux 5.5+, 6.x SuSE Linux Enterprise Server 10.x, 11.x Ubuntu Linux 10.04 LTS, 11.04 • Solaris x86/SPARC • Solaris 10.9+, 11.x • Apple OSX x86 • will be supported post-GA, detailed plan TBD Note: JDK 7 should run on pretty much any Windows/Linux/Solaris. These configurations are the ones primarily tested by Oracle, and for which we provide commercial support. 57 Thursday, December 8, 2011
  • 58. JVM Convergence – Forward looking Project “HotRockit” JDK 7 GA – 07/11 JDK 7u2 JDK 7uX JDK 8 GA • Hotspot 21 • Hotspot 22 • Hotspot 23 • Hotspot24 • Java SE 7 Support • Performance • More performance • Java SE 8 Support • Rebranding • Enable large heaps • Improved command • All performance • Improved JMX Agent • Command line servicability tool (jrcmd) --- Premium --• Improved JRockit Mission Control Console support Thursday, December 8, 2011 with reasonable latencies line servicability (jcmd) • Enable large heaps with consistent reasonable latencies • No PermGen --- Premium --• Complete JRockit Flight Recorder Support features from JRockit ported • All servicability features from JRockit ported • Compiler controls • Verbose logging --- Premium --• JRockit Mission Control Memleak Tool Support • Soft Real Time GC
  • 59. JDK Roadmap JDK 7u6 NetBeans 7 • Java SE 7 support • more JDK 7u2 JDK 7 • JRE 7 on java.com • JavaFX 2.0 co-install 2011 Last public JDK 6 update • OS X JRE port (for end-users) • Improved OS integration, autoupdate NetBeans.next • Java SE 8 support • JavaFX 3.0 support • more 2013 2012 2014 Mac OS X JDK 7u4 JDK 8 • JDK 7 Dev Preview • JavaFX 2.0 Dev Preview • OS X JDK Port (for developers) • Windows, Linux, Solaris, OS X • Jigsaw • Lambda • JavaFX 3.0 • Complete Oracle JVM convergence • JavaScript interop • more NetBeans 7.1 • JavaFX 2.0 support Thursday, December 8, 2011
  • 60. JDK 8 - Summer 2013 • Strong feedback from community – 2 years needed between JDK releases • Release date revised to summer 2013 (from late 2012) • Enables larger scope, such as: – Jigsaw – complete platform modularization, container support – Lambda – Bulk operations – JavaScript Interop – Device Support Thursday, December 8, 2011 Theme Description/Content Project Jigsaw EXPANDED • Module system for Java applications and the Java platform Project Lambda EXPANDED • Closures and related features in the Java language (JSR 335) • Bulk parallel operations in Java collections APIs (filter/map/reduce) Oracle JVM Convergence • Complete migration of performance and serviceability features from JRockit, including Mission Control and the Flight Recorder JavaFX 3.0 • Next generation Java client JavaScript NEW Device Support NEW • Next-gen JavaScript-on-JVM engine (Project Nashorn) • JavaScript/Java interoperability on JVM • Multi-Touch (JavaFX), Camera, Location, Compass and Accelerometer Developer Productivity • Annotations on types (JSR 308), Minor language enhancements API and Other Updates • Enhancements to Security, Date/Time, (JSR 310) Networking, Internationalization, Accessibility, Packaging/Installation Open Source • Open development in OpenJDK, open source additional closed components
  • 61. JDK Enhancement Proposal (JEP) Process • “A process for collecting, reviewing, sorting, and recording the results of proposals for enhancements to the JDK” • Goal: Produce a regularly-updated list of proposals to serve as the long-term Roadmap for JDK Release Projects • Looks at least three years into the future to allow time for the most complex proposals to be defined and implemented • Open to every OpenJDK Committer • Does not in any way supplant the Java Community Process Thursday, December 8, 2011
  • 62. JEPs as of 11/11/11 (11:11:11) • • • • • • • • • • • • • • • • • • • • • • • • • • • • 1 2 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 Thursday, December 8, 2011 JDK Enhancement-Proposal & Roadmap Process JEP Template Generalized Target-Type Inference Process API Updates Parallel Array Sorting Annotations on Java Types DocTree API Add Javadoc to javax.tools Bulk Data Operations for Collections Collections Enhancements from Third-Party Libraries Enhance Core Libraries with Lambda New HTTP Client Additional Unicode Constructs for Regular Expressions Charset Implementation Improvements MS-SFU Kerberos 5 Extensions TLS Server Name Indication (SNI) Extension AEAD CipherSuites Extended Validation Certificates Remove the Annotation-Processing Tool (apt) Access to Parameter Names at Runtime javax.lang.model Implementation Backed by Core Reflection Repeating Annotations Stronger Algorithms for Password-Based Encryption Remove the Permanent Generation Configurable Secure Random-Number Generation Enhance the Certificate Revocation-Checking API Network Interface Aliases, Events, and Defaults Lambda Expressions and Virtual Extension Methods
  • 63. Conclusions • Java SE 7 • Incremental changes • Evolutionary, not revolutionary • Good solid set of features to make developers life easier • Java SE 8 • Major new features: Modularisation and Closures • More smaller features to be defined • Java continues to grow and adapt to the changing world of IT 63 Thursday, December 8, 2011
  • 64. The preceding 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. 64 Thursday, December 8, 2011