With its ninth version, the Java platform has shifted gear and introduced biyearly releases. This was followed by a license change where Oracle, the steward of Java, now publishes a commercial and a non-commercial release of the Java virtual machine while other vendors took more space to promote their alternative builds of the OpenJDK. And in another flood of news, the Java EE specification was terminated and resolved into the Jakarta EE namespace.
A lot has been happening in the traditionally conservative Java ecosystem, to say the least, and many users are wondering if they still can rely on the platform. This talk gives an overview of the Java ecosystem, summarizes the changes that have been, that to expect and why the evolution of the platform is good news to the community.
2. What do I want to accomplish with this talk?
Software consultant at day,
open source developer at night.
3. What is Java anyways?
JLS JVMSJava Language Specification Java Virtual Machine Specification
51 character sequences, formed from ASCII
letters, are reserved for use as keywords
and cannot be used as identifiers (§3.8).
Class and interface names that appear in class file structures
are always represented in a fully qualified form known as
binary names (JLS §13.1). Such names are always represented
as CONSTANT_Utf8_info structures (§4.4.7) and thus may be
drawn, where not further constrained, from the entire Unicode
codespace.
Language Preview Specifications
+
One specification per major release, no changes in update releases: https://docs.oracle.com/javase/specs/
1. Introduction 11. Exceptions
2. Grammar 12. Execution
3. Lexical structure 13. Binary compatibility
4. Types, values, variables 14. Blocks, statements
5. Conversions, contexts 15. Expressions
6. Names 16. Definite assignment
7. Packages, modules 17. Threads, locks
8. Classes 18. Type inference
9. Interfaces 19. Syntax
10. Arrays
1. Introduction
2. JVM structure
3. Compilation
4. Class file format
5. Loading, linking,
initialization
6. JVM instruction set
7. Opcode mnemonics
4. JEPJava Enhancement Proposal
JSRJava Specification Request
Java Language Specification
Java Virtual Machine Specification
JCKJava Compatibility Kit
TCKsSpecification Test Kits
The Java Community Process (JCP).
Java Servlet Specification
Java Message Specification
Java RESTful Web Services (JAX-RS)
...
ECExecutive Committee
2020: Alibaba, ARM, Azul, BNY Mellon, Credit Suisse, Eclipse Foundation, Fujitsu,
Goldman Sachs, JetBrains, Hazelcast, Hewlett Packard, IBM, Intel, London Java
Community, MicroDoc, Oracle, SAP, Software AG, SouJava, Tomitribe, Twitter, V2COM
OpenJDK Community TCK and EA TCK
License Agreement (OCTLA)
spec lead and expert group
Jakarta Servlet Specification
Jakarta Message Specification
Jakarta RESTful Web Services (JAX-RS)
...
Jakarta EE Working Group
Jakarta EE Steering Committee
5. The Java Community Process (JCP) by example: The Java platform module system (JPMS)
JEP
JEP 261: Module system
JEP 200: The Modular JDK
JEP 201: Modular Source Code
JEP 220: Modular
Runtime Images
JEP 162: Prepare
for Modularization
JEP 179: Document JDK
API Support and Stability
JEP 281: jlink – The Java Linker
JEP 275: Modular Java
Application Packaging
JEP 260: Encapsulate Most
Internal APIs
JSR
RI
JSR 376: Java Platform
Module System
Maling lists:
jpms-spec-experts
jpms-spec-observers
jpms-spec-comments
Voting process:
12.2014 JSR Review
11.2015 JSR Renewal
04.2017 Review
06.2017 Review Reconsideration
08.2017 Final Approval
OpenJDK
OpenJDK project: Jigsaw
Maling lists:
jigsaw-dev
Project sponsor:
Compiler Group
EA build: jdk.java.net
Specification diffs:
JLS, JVMTS, JAR, JNI,
JVMTI, JDWP
6. Specification versus implementation
Many ways to implement a Java virtual machine specification compliant. This is more obvious for Java EE where
different application containers are explicitly branded as such.
Sun HotSpot Appeal VM JRockit Apache Harmony
Java compatibility kit (JCK) - not open-sourced
JVMS? JVMS? JVMS?
GPL + CP exception commercial Apache license
public static void main(String[] args) {
System.out.println("Hello world!");
}
OCTLA: free if made available
under the GPL, no change within
namespace, heavily OpenJDK-
derived, Oracle-approved
7. OpenJDK: a project to implement a reference of the specification for common use
jdk jdk*u
hg.openjdk.java.net
mirror.vendor.com
jdk.java.net
(Java 14 EA)
adoptopenjdk.net
(Java 8 - 13)
OpenJDK Vulnerability
Group (OJVG)
aws.amazon.com/corretto
azul.com
bell-sw.com
developers.redhat.com/products/openjdk
sap.github.io/SapMachine
oracle.com/technetwork/java/javase
Oracle contributor agreement (OCA):
shared copyright with Oracle
jdk.java.net
(Java 13, 6 months)
8. The OpenJDK project: governance model.
Group
Project
Participant
Contributor
OpenJDK
Member
OpenJDK Lead
JDK Release
Project
Group Lead
Group MemberAuthor
Committer
Reviewer
Project Lead Chair
2x At-Large
Member
Vice-Chair
x Observer
openjdk.java.net/census
9. The OpenJDK project: proposing and applying a patch.
Request for
Enhancement (RFE)
Request for
Comments (RFC)
Request for Review
(RFR)
patch
hg diff (inline)
webrev
Sponsor
jtreg JCK
Merge
Compatibility and
Specification
Review (CSR)
Backport
1. Remember tooling. 4. Remember JVMTI
2. Remember JNI 5. Remember JPDA.
3. Remember reflection API. 6. Remember serialization.
11. The OpenJDK project: clone, build and test DIY.
sudo apt install mercurial
./build/linux-x86_64-server-release/jdk/bin/java --fullversion
hg clone https://hg.openjdk.java.net/jdk/jdk
cd jdk
sudo apt install build-essential
bash configure --with-boot-jdk=~/jdk-13
make images
hg clone https://hg.openjdk.java.net/code-tools/jtreg
sh jtreg/make/build-all.sh ~/jdk-8
bash configure --with-boot-jdk=~/jdk-13 --disable-warnings-as-errors
openjdk full version "14-internal+0-adhoc.rafael.jdk"
export JT_HOME=~/jtreg/build/images/jtreg
bash configure --with-boot-jdk=~/jdk-13 --disable-warnings-as-errors
make test-tier1
12. In what way do OpenJDK builds differ?
jdk jdk*u
hg.openjdk.java.net
hotspot
java.base
jdk.compiler
jdk jdk*u
OpenJ9
openj9
java.base
jdk.compiler
jdk jdk*u
Azul Zing
hotspot
java.base
jdk.compiler
hotspot/gc/c4
hotspot/jit/falcon
hotspot/readynow
JDK JRE-compact1 JRE (with JavaFX)JRE
multiple binaries
possible
13. What are the more common OpenJDK distributions?
ZULUZING
Oracle OpenJDK
14. Other VMs that offer subset functionality.
DAVLIK ART
CE EE Substrate
Does not support all standard APIs,
e.g. java.awt, java.swing, java.beans,
java.instrumentation.
Does not support Java byte code at
runtime (Dalvik: dex format, ART: native).
JCK-approved VM unless compiled via
native-image extension (Substrate VM):
- Requires setup to use reflection.
- JVMTI and security manager not supported.
- Dynamic byte code not supported.
- Method handles and invokedynamic (unless via
lambda meta factory) not supported.
15. Name Runtime JIT GC Versions Platforms Free Support JCK
AdoptOpenJDK HotSpot C1/C2 G1, SR, PL, ZGC, SH* 8 - 13 Linux, Mac, Win Yes Yes No
AdoptOpenJDK OpenJ9 OpenJ9 Openj9 8 - 13 Linux, Mac, Win Yes Yes No
Oracle OpenJDK HotSpot C1/C2 G1, SR, PL, ZGC 13, 14-EA, EA Linux, Mac, Win* Yes No Yes
Oracle JDK HotSpot C1/C2 G1, SR, PL, ZGC 8, 11, 13 Linux, Mac, Win No Yes Yes
Azul Zing HotSpot C1/Falcon C4 8, 11 Linux No Yes Yes
Azul Zulu HotSpot C1/C2 G1, SR, PL, ZGC, SH* 6 - 13 Linux, Mac, Win Yes Yes Yes
Red Hat OpenJDK HotSpot C1/C2 G1, SR, PL, ZGC, SH 8, 11, 13 RHE Linux, Win Yes Yes Yes
SAP Machine HotSpot C1/C2 G1, SR, PL, ZGC, SH* 11, 13 Linux, Mac, Win Yes No Yes
Corretto HotSpot C1/C2 G1, SR, PL, ZGC 8, 11 Linux, Mac, Win Yes On AWS Yes
Liberica HotSpot C1/C2 G1, SR, PL, ZGC, SH* 8, 11, 13 Linux, Mac, Win Yes Yes Yes
Dragonwell HotSpot C1/C2 G1, SR, PL 8 Linux Yes No Yes
Pivotal Spring RT HotSpot C1/C2 G1, SR, PL 7 - 12 Linux Yes Yes No
Graal VM HotSpot C1/Graal G1, SR, PL 8 Linux, Mac, Win* Both Yes Yes
Substrate VM None Graal GenScavenge 8 Linux, Mac, Win* Both Yes No
Android ART ART ART 7 (subset 8) Android Yes No No
Debian HotSpot C1/C2 G1, SR, PL, ZGC, SH* 8 - 13 Linux Yes No No
Note: ZGC supported since Java 11. Deprecated CMS not mentioned. Shenandoah (SH) marked with a star available since Java 12. SR = serial, PL = parallel. Only subset of platforms.
16. Java is still free (dah!).
java -XX:+UnlockCommercialFeatures MyApp
java MyApp
Oracle OpenJDK
java -XX:+UnlockCommercialFeatures MyApp
java MyApp
java MyApp
Java 8u202 (January 2019)
Java 8u211 (April 2019)
java -XX:+UnlockCommercialFeatures MyApp
Java 8u40 (March 2015)
Java 13.0.1 (October 2019), updates until March 2020
Old versions: No license change!
Free unless commercial options are
enabled in production environments.
17. Release cadence: Oracle OpenJDK vs Oracle JDK.
Sep '17 Mar '18 Sep '18 Mar '19 Sep '19 Mar '20 Sep '20 Mar '21
Java 9 Java 10 Java 11 Java 12 Java 13 Java 14 Java 15
Java 8 (until March 2022, extended: March 2025)
Java 11 (until March 2023, extended March 2026)
Java 8
Java 12 Java 13 Java 14 Java 15
18. Release cadence: Red Hat OpenJDK and others.
Sep '17 Mar '18 Sep '18 Mar '19 Sep '19 Mar '20 Sep '20 Mar '21
Java 8 (until June 2023)
Java 11 (until October 2024)
Java 8
Java 11
Java 7 (until June 2020)
19. Release cadence: Azul Zulu.
Sep '17 Mar '18 Sep '18 Mar '19 Sep '19 Mar '20 Sep '20 Mar '21
Java 6 (until December 2021)
Java 13 (March 2023)
Java 7 (until July 2023)
Java 8 (until March 2026)
Java 11 (until September 2027)
Java 15
(March 2023)
Java 6 (until 2019)
20. How involved are companies in the OpenJDK?
Sources: https://blogs.oracle.com/java-platform-group/building-jdk-11-together
https://blogs.oracle.com/java-platform-group/the-arrival-of-java-13
22. Adoption strategy: bleeding edge versus LTS.
Java 8
(bytecode 52)
Java 11
(bytecode 55)
module-info.class
encapsulation of reflective access
built-in class loader implementation change
platform class loader replaces extension mechanism
new URL schema for class file resources
new version string format
reduction of preconfigured modules
(in Java 9)
Java 13
(bytecode 57)
Enhanced deprecation
(since Java 10)
sun.misc.Unsafe::defineClass removed
(in Java 12)
Java 14-EA
(bytecode 58)
-net.bytebuddy.experimental=true
Java 14+X
(bytecode 58+X)
invokedynamic (Java 7)
nestmates (Java 11)
constantdynamic (Java 11)
java.bytecode.* (?)
Most changes are
performance
improvements or
feature extensions!
Update your libraries,
don't "hack" and you
should be fine.
23. Migrating from Java EE to Jakarta EE.
jakarta.servlet.*
jakarta.ws.rs.*
...
javax.servlet.*
javax.ws.rs.*
...
javax.sql.*
javax.management.*
...
public class LegacyServletBridge implements jakarta.servlet.Servlet {
private final javax.servlet.Servlet delegate;
public LegacyServlet(javax.servlet.Servlet delegate) {
this.delegate = delegate;
}
@Override public void service(jakarta.servlet.ServletRequest req,
jakarta.servlet.ServletResponse resp) {
delegate.service(new LegacyServletRequest(req),
new LegacyServletResponse(resp));
}
}
org.hibernate.validation.* javax.validation.*
24. The Java developer (advocacy) community.
developer
advocacy
developer
"recognition"
developer
awards
meetups and
developer
conferences
26. Project preview: Panama.
jdk.java.net/panama
foreign function interface
data layouts
jextract
-t nvidia -L /usr/lib -lnvidia-ml
--record-library-path
/opt/cuda/targets/x86_64-linux/include/nvml.h
-o nvidia.jar
import java.foreign.*;
import java.foreign.memory.*;
import java.lang.invoke.MethodHandles;
import nvidia.nvml_h;
import nvidia.nvml_lib;
public class Sample {
public static void main(String[] args) {
Libraries.loadLibrary(MethodHandles.lookup(), "nvidia-ml");
try(Scope s = nvml_lib.scope().fork()) {
nvml_lib.nvmlInit_v2();
}
}
}
Look into JNA for a currently
available solution without
direct JVM-support.
27. Project preview: Valhalla.
a
b
c
class NonPrimitiveSample {
Integer a, b, c;
}
Integer
42
class PrimitiveSample {
int a, b, c;
}
a = 42
b = 84
c = 1
object
object
Integer
84
object
object
Integer
1
object
object
new PrimitiveSample()
new NonPrimitiveSample()
jdk.java.net/valhalla
inline types
generic specialization
cache lines: stales processor
inline class
28. Project review and preview: Amber.
Collection of language extensions:
Local variable type inference (Java 10)
Switch expressions (Java 12, Java 13, preview)
Pattern matching for instanceof
Records
Enhanced enums (on hold)
var value = "Hello World!";
Function<String, String> f = (@NonNull var arg) -> arg;Function<String, String> f = arg -> arg;Function<String, String> f = (var arg) -> arg;
int result = switch (input) {
case "foo" -> 1;
case "bar" -> 2;
default -> 3;
}
int result;
switch (input) {
case "foo":
result = 1;
break;
case "bar":
result = 2;
break;
default:
result = 3;
}
"twonlinesn""""
two
lines
"""
Object o = fetch();
if (o instanceof String s) {
String result = s;
}
String text = String.format("%s: %d",
new Object[] {"foo", new Integer(42)});
String text = String.format("%s: %d", "foo", 42);
Local-variable syntax for lambda parameters (Java 11)
Text blocks (Java 13, preview)
Java Compiler intrinsics API
Sealed types
Lambda leftovers (on hold)
String text =
(invokedynamic) DynamicFormat::format,
"%s: %d", "foo", 42;
sealed interface Base permits Foo, Bar { }
record Foo(String bar) { }