Modern Java: A Version Feature Guide
What changed in each release since Java 8, which old habits it replaces, and what to reach for in new code today.
Advanced level material.
45 notes tagged
What changed in each release since Java 8, which old habits it replaces, and what to reach for in new code today.
An immutable object cannot change after construction, which removes whole categories of bug at the cost of a little copying.
A sealed type names exactly which types may extend it, which lets the compiler check that a pattern switch covers every case.
Modules add a boundary above packages: a module declares what it needs and what it exposes, and everything else stays private.
A dynamic proxy implements an interface at runtime and routes every call through one handler, which is how cross cutting behaviour is added.
Reflection inspects and manipulates classes at runtime. It powers most frameworks and should be rare in application code.
Java can still leak: any object the program keeps reachable but no longer needs. Here is how to find and fix them.
The collector reclaims objects that can no longer be reached. Understanding reachability explains both leaks and pauses.
Where each piece of data actually lives, and what runs out when each area is exhausted.
Classes are found, verified, prepared and initialised on first use, by a hierarchy of loaders that delegate upwards.
The class loader, the runtime data areas and the execution engine, and how a class file becomes running machine code.
The rules that decide when a write by one thread becomes visible to another, expressed as the happens-before relationship.