• Stars
    star
    301
  • Rank 137,612 (Top 3 %)
  • Language
    Java
  • License
    MIT License
  • Created about 8 years ago
  • Updated 11 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Demonstrates Java 9-18's new features

Java X Feature Demo

Demonstrates most features that were introduced after Java 8. They are listed below with links that take you to the demos in this repo, the JEPs responsible for introducing the feature, and to other sources if available. These are the categories:

Circled numbers like ⑰ indicate which Java version introduced a feature or a change. A circled X ⓧ indicates an incubating or previewing feature that is not yet standardized - it can be experimented with but is subject to change.

For a more practical approach to many of these features, including some quick code metrics, check my Java After Eight repo. You can find more from me on nipafx.dev as well as on YouTube and Twitch. To get in touch, follow me on Twitter (DMs are open) or join my Discord.

Setup

This project requires at least the most recent Java release, at times even early-access builds of upcoming versions. You can get OpenJDK builds for both directly from jdk.java.net, although I prefer to use SDKMAN to install and manage them. The project can be built with Maven, i.e. mvn package.

There are several ways to execute demos:

  • If your IDE is up to speed (which may require preview versions or additional plugins), you can execute most demos straight from there.
  • If a feature is contained in a single class, you can also use single-source file execution and just call java $SOURCE_FILE.
  • You can always build with mvn package and then run any specific class with ...
     java -p target/java-x.jar -m dev.nipafx.demo.java_x/$CLASS
    ... where $CLASS is the fully qualified name of the class you want to execute.

Depending on the demo you may have to add additional command line flags - this should be listed in the respective file.

For some features, you have to run the .sh scripts in this repo's root directory to see them in action. If that's necessary, the feature list below mentions it. For that to work, you need to ensure that a java binary from the respective JDK version is available on your path - again, I use SDKMAN for that.

Language Changes

Module System

The module system is too big to demo here. Check out the j_ms tag on my blog (for example to find this handy cheat-sheet), the dedicated demo project, a project with solutions to common issues, or my book The Java Module System.

New APIs

If an API that was introduced in Java 9+ was later updated, the update is listed in the next section.

Updated APIs

A few changes have their own articles (in which case they are linked), but many don't. Some of them are show-cased in these posts, though:

Tooling

Runtime

Internals

More Repositories

1

loom-lab

Experimenting with Project Loom
Java
115
star
2

demo-jpms-monitor

A small application to demonstrate the Java Platform Module System
Java
72
star
3

demo-junit-5

Demonstrating JUnit 5 features
Java
71
star
4

modern-java-demo

Modern Java in Action
Java
60
star
5

LibFX

Makes Java even more fun!
Java
53
star
6

slides

Slides for various talks I give
CSS
34
star
7

java-after-eight

Start with Java 11, be amazed by Java 12-17 and beyond
Java
27
star
8

effective-java

Exploration of Effective Java, third edition
Java
26
star
9

module-system-woes

Solutions to common troubles with Java's module system
Java
24
star
10

demo-java-9-migration

A demo code base for a Java 9 migration
Java
23
star
11

record-args

A simple command-line argument parser for Java applications that relies on records.
Java
16
star
12

JDeps-Maven-Plugin

Includes JDeps in Maven
Java
16
star
13

demo-jigsaw-advent-calendar

An Advent Calendar Demonstrating Jigsaw EA
16
star
14

demo-decorator-java-8

Demonstrates how the decorator pattern could be implemented using the features of Java 8.
Java
15
star
15

advent-of-code-2023

Java solutions for Advent of Code 2023
Java
14
star
16

mvn-java-9

Java
13
star
17

nipafx.dev

My website
JavaScript
12
star
18

java-ecosystem-map

A visualization of the core concepts of the Java ecosystem.
TypeScript
9
star
19

demo-jpms-hello-world

Simple Hello-World example for the Java Platform Module System (JPMS)
Java
8
star
20

livefx

Java
6
star
21

lab-junitlambda

Toying around with the JUnit Lambda Prototype
Java
5
star
22

demo-jigsaw-reflection

Demonstrates how strongly Jigsaw encapsulates module internals against reflection
Shell
5
star
23

demo-javadoc-8-tags

Demonstrates the new Javadoc tags used in Java 8
CSS
4
star
24

demo-serialization-proxy-pattern

Demonstrates the Serialization Proxy Pattern
Java
4
star
25

calendar

A simple calendar view
TypeScript
3
star
26

benchmarks

Arbitrary Java performance benchmarks
Java
3
star
27

demo-serialize-optional

Demonstrates how Optionals can be (de)serialized.
Java
3
star
28

demo-java9-jsr305

How to use JSR-305 on Java 9
Shell
2
star
29

Caliz

Wrapping Graal AOT for fast scripts with Java
Java
2
star
30

demo-elvis-operator

Shows how to create an Elvis (or null coalescing) operator with lambda expressions.
Java
1
star
31

ginevra

A Gatsby-like static site generator
Java
1
star