One Step Closer

Cloning, Coding, And Building The JDK

Developer Advocate

Java Team at Oracle

Lots to talk about

The plan for today:

  • get to know OpenJDK

  • clone the JDK codebase

  • set up a build and execute it

  • make a few simple API changes

  • build our hand-made JDK and use it

Caveats

  • I don’t actually know what I’m talking about

  • this only covers my setup, ymmv

  • this is a proof of concept, not a tutorial

OpenJDK

It’s a bird!
It’s a plane!
It’s OpenJDK!

OpenJDK is many things:

  • we’ll discuss the details later

  • let’s dig into the code first

Code

Code, code, code, code

But why?!

  • it’s fun 😁

  • removes magic from your project

  • makes it easier to contribute

Contribute?

Contribute:

Not every contribution has to be code:

OpenJDK

We’ve seen the OpenJDK code.

But what is OpenJDK?

Let’s check openjdk.org…​

What is OpenJDK?

What is this? The place to collaborate on an open-source implementation of the Java Platform, Standard Edition, and related projects.

Also:

Major Linux distributions […​] offer OpenJDK as their default Java SE implementation.

🤔

What is OpenJDK?

What is OpenJDK?

It’s complicated - OpenJDK is many things:

A community

of companies and individuals with a stake in Java

A project

that discusses, plans, and implements changes to the OpenJDK code base

A code base

with Java’s reference implementation that’s the source of truth for most JDK distros out there

What is OpenJDK not?

OpenJDK is no Java distribution!

It doesn’t ship binaries, but others do:

OpenJDK as a code base

How is the OpenJDK code base developed?

That’s complicated, too!

RedHat’s Aleksey Shipilëv (@shipilev)
made a nice diagram.

OpenJDK clone army

There are many clones:

  • we’ve seen the canonical repo

  • every Java version has their clone

  • every project has their clone

  • every distribution has their clones

For ease of understanding,
let’s think of clones as branches.

OpenJDK development

A new feature, simplified:

  • developed in "feature branch"

  • merged into "master" when (nearly) finished

A release, simplified:

  • "release branch" created 3 months prior

  • only bug fixes merged to "release branch"

A bug/security/etc fix, simplified:

  • usually developed in "master"

  • merged into relevant release branches

OpenJDK development

Not that complicated after all.

But what you would expect…​

  • from a large code base

  • housing an important project

  • gouverned by a diverse community

Summary

  • OpenJDK is a community / project / code base

  • the code base is large, but no magic

  • you can start working on it in an afternoon

  • why not give it a try and contribute?

So long…​

37% off with
code fccparlog

bit.ly/the-jms

More

Slides at slides.nipafx.dev
⇜ Get my book!

Follow Nicolai

nipafx.dev
/nipafx

Follow Java

inside.java // dev.java
/java    //    /openjdk

Image Credits