@jeanneboyarsky Martijn Verberg (JClarity) Simon Ritter (Azul) Steve Poole & Tim Ellison (IBM) Simon Maple (LJC) Trisha Gee (JetBrains) Roman Kennke (Red Hat) Thank you to…
@jeanneboyarsky Wait, a major version every 6 months? • + Syntax changes • + Smaller features • - Years of features JDK 10 JDK 11 12 new features 15 new features 14
@jeanneboyarsky How many languages do you know? q One (or zero) q Two – Five q Six or more Examples • Java • Kotlin • Groovy • Scala • SQL • HTML • JavaScript • CSS 18
@jeanneboyarsky Oracle/OpenJDK Arrivals Train Schedule Java Release Date Long Term Support 9 September 21, 2017 10 March 20, 2018 11 September 25, 2018 T h e i 24
@jeanneboyarsky Wait. So what happens next? How long will Java 12 have Oracle patches? Answer: 6 months What is the next LTS version after Java 11? Java 11 + 3*2 = 17 28
@jeanneboyarsky A Tale of Two JDKs Java Oracle JDK Open JDK New Version Every 3 years Every 6 months Cost Paid Free Upgrade Options • Security patch • Next version • OpenJDK • Interim security patch • Next version 29 Note: Oracle also publishes Open JDK 6 months for dev; not EA
@jeanneboyarsky FUD quiz #7 Is it enough to pass the TCK (Technology Compatibility Kit) to be Java SE? No. If vendor doesn’t pay Oracle, “Java SE Compatible” 39
@jeanneboyarsky Vendor JDKs • Vulnerability Security Group • Backporting – non trivial • Features removed • What is a bug/security patch/enhancement 40
@jeanneboyarsky 42 Java 8 Free Updates – Adopt OpenJDK Paid support - IBM March 2023+ Java 11 Free updates – Adopt OpenJDK Paid support - IBM Sept 2022+ All others Free updates – Adopt OpenJDK 6 months Adopt OpenJDK + IBM + means support as long as source maintained
@jeanneboyarsky 43 RedHat -> IBM • Java 8, 9, 10 still available • Java 8 and 11 supported • Will maintain OpenJDK after Oracle support ends • IBM keeping RedHat somewhat independent?
@jeanneboyarsky Tip: Aliases alias javac11=/Library/Java/JavaVirtualMachines/ jdk-11.jdk/Contents/Home/bin/javac alias java11=/Library/Java/JavaVirtualMachines/ jdk-11.jdk/Contents/Home/bin/java 47
@jeanneboyarsky String name = "Jeanne”; var name = "Jeanne"; List list = List.of(1, 2, 3); var list = List.of(1, 2, 3); • Syntactical sugar/less boilerplate • Not immutable (no val) (10) 49
@jeanneboyarsky List headers = thead.findElements(By.tagName("th")); VolunteerDashboardRow headerRow = new VolunteerDashboardRow(headers); vs var headers = thead.findElements(By.tagName("th")); var headerRow = new VolunteerDashboardRow(headers); (10) 51
@jeanneboyarsky (10) Pros Cons Less typing Loss of information Less redundancy Variable names matter more Can scan variable names Be careful! 57 http://openjdk.java.net/projects/amber/LVTIstyle.html
@jeanneboyarsky Epsilon GC (11) • Never reclaims memory • Program proceeds until run out of heap • GC never runs • To use: • -XX:+UseEpsilonGC • (or) -XX:+UseNoGC 65
@jeanneboyarsky Epsilon GC Good for (11) • Performance/memory stress test • Very short programs • Last ditch performance improvements (this probably isn’t you) 66
@jeanneboyarsky Z GC (11) • Experimental • 10ms or less pause time • Only for Linux/x64 • To use, enable both: • -XX:+UnlockExperimentalVMOptions • -XX:+UseZGC 67
@jeanneboyarsky (11) var uri = "http://www.google.com"; var client = HttpClient.newHttpClient(); var request = HttpRequest.newBuilder() .uri(URI.create(uri)) .build(); var response = client.send(request, BodyHandlers.ofString()); System.out.println(response.body()); 69
@jeanneboyarsky System.out.println( System.getProperty("java.version.date")); (10) 10.0.1 11-ea 2018-04-17 2018-09-25 When run in June. Yes, the future! 77
@jeanneboyarsky System.out.println( System.getProperty("java.version.version")); • Null for Open JDK • For vendor use (10) Yes, version is here twice! 78
@jeanneboyarsky New java launcher mode Full command Shorthand javac HelloWorld.java java HelloWorld java HelloWorld.java Produces class file Fully in memory For any program For programs with one class (11) 80
@jeanneboyarsky Tying it all together (10+11) 88 import java.nio.charset.*; public class Unicode { public static void main(String... args) { System.out.print("Have a \uD83C\uDF7A"); System.out.println(" or a \uD83E\uDD64"); } }