wtf is in Java/JDK/wtf7?

24
wtf is in Java/JDK/wtf ??? 7 Scott Leberknight

description

Slides for a short lightning talk I gave at Near Infinity (www.nearinfinity.com) on what exactly is in JDK7.

Transcript of wtf is in Java/JDK/wtf7?

Page 1: wtf is in Java/JDK/wtf7?

wtfis in Java/JDK/wtf ???7

Scott Leberknight

Page 2: wtf is in Java/JDK/wtf7?

"Making Java suck (a little) less..."

Page 3: wtf is in Java/JDK/wtf7?

jsr-203(NIO.2)

Page 4: wtf is in Java/JDK/wtf7?

java.nio.file

// old way (deprecated)File file = new File("foo.txt");

// new wayPath path = Paths.get("foo.txt");

Path path = file.toPath();

Page 5: wtf is in Java/JDK/wtf7?

FileStore

FileSystem(s)

Files(finally, you can copy a file...only took ~15 years)

Page 6: wtf is in Java/JDK/wtf7?

scalable, asynchronous I/O

socket-channel binding & config

(AsynchronousChannel & friends)

(NetworkChannel & friends)

Page 7: wtf is in Java/JDK/wtf7?

jsr-292(invokedynamic)

Page 8: wtf is in Java/JDK/wtf7?

invokestatic invokespecial

invokevirtual invokeinterface

invokedynamic (new)

invokedynamic

"...an invokedynamic instruction is used to call methods which have linkage and dispatch

semantics defined by non-Java languages..."- http://www.infoq.com/articles/invokedynamic

Page 9: wtf is in Java/JDK/wtf7?

jsr-334(Project Coin)

Page 10: wtf is in Java/JDK/wtf7?

strings in switch

switch (action) { case "Red": stop(); break; case "Yellow": slowDown(); break; case "Green": go(); break; case "Blue": danceAJig(); break;}

Page 11: wtf is in Java/JDK/wtf7?

binary literals

int clutchSong = 0b10001110101;

http://www.amazon.com/Robot-Hive-Exodus-Clutch/dp/B0009NSE1K

Page 12: wtf is in Java/JDK/wtf7?

short/byte literals

byte b = 42y;

short s = 32767s;

Page 13: wtf is in Java/JDK/wtf7?

underscores in numeric literals

long max = 9_223_372_036_854_775_807L;

int song = 0b0100_0111_0101;

Page 14: wtf is in Java/JDK/wtf7?

multi-catch

try { // code...}catch (FileNotFoundException | NoSuchFileException | AccessDeniedException ex) { // handle...}

Page 15: wtf is in Java/JDK/wtf7?

final re-throw

try { actionThatThrowsIOException(); actionThatThrowsSQLException();}catch (final Exception e) { // handle...

throw e; // IOException or SQLException}

Page 16: wtf is in Java/JDK/wtf7?

ARM

try (InputStream is = url.openStream(); OutputStream os = new FileOutputStream(file)) {

// use resources...

}

(automatic resource

management)

(AutoCloseable)

Page 17: wtf is in Java/JDK/wtf7?

diamond operator

Map<String, Map<Integer, List<String>>> things = new HashMap<>();

Page 18: wtf is in Java/JDK/wtf7?

modified JSRsJava Compiler API (jsr 199)

JAXP 1.3 (jsr 206)

JAXB 2.2 (jsr 222)

JAX-WS 2.2 (jsr 224)

Pluggable Annotation Processing (jsr 269)

Page 19: wtf is in Java/JDK/wtf7?

java.util.Objects

Enhanced JMX agent and MBeans

honorable mention

jsr166y - Concurrency & collections updates

Method to close a URLClassLoader

Autoloading of JDBC drivers

JDBC 4.1

Page 20: wtf is in Java/JDK/wtf7?

assembly-coding

Class Loader architecture updates (parallel-capable)

Strict class file checking

Elliptic curve cryptography (ECC)

New garbage collector (lower pause times & better predictability than current CMS collector)

Page 21: wtf is in Java/JDK/wtf7?

deferreduntil JDK 8

(sometime next century)

Page 22: wtf is in Java/JDK/wtf7?

Project Lambda(a.k.a. closures)

Collection LiteralsList<Integer> items = [1, 2, 3, 4, 5];

Modularity(JSR 294 modules, formerly superpackages)

deferred

Page 23: wtf is in Java/JDK/wtf7?

http://jdk7.java.net/

http://jdk7.java.net/preview/

http://download.java.net/jdk7/docs/api/

http://www.vineetmanohar.com/2011/03/installing-java-7-on-mac-os-x/

http://www.infoq.com/articles/invokedynamic

http://openjdk.java.net/projects/jdk7/features/

http://marxsoftware.blogspot.com/2011/03/jdk-7-new-interfaces-classes-enums-and.html

references

Page 24: wtf is in Java/JDK/wtf7?

(the end)

[email protected]

www.nearinfinity.com/blogs/

twitter: sleberknight