r/SpringBoot • • Apr 01 '26

How-To/Tutorial What if Java had Kotlin-style null-safety without migrating your Spring Boot project to Kotlin?

Hey r/SpringBoot,

I've been working on JADEx (Java Advanced Development Extension) which is a safety layer that makes Java safer by adding Null-Safety and Final-by-Default semantics without rewriting Java codes and modifying the JVM.

Quick recap of what JADEx adds to Java:

  • String? nullable type declaration
  • ?. null-safe access operator
  • ?: Elvis operator
  • apply readonly final-by-default mode per file

Today I'm sharing three things that just landed.


1. Lombok support

This was the most requested thing. JADEx now integrates with Lombok via a Delombok pipeline internally. The key motivation: JADEx's nullability checker needs to see Lombok-generated code (getters, builders, constructors) to avoid blind spots. Without Delombok, nullable fields could silently pass through generated methods unchecked.

@Data
@Builder
@Entity
public class User {
    private String name;
    private String? email;      // @Nullable propagated to getter + builder param
    private Address? address;   // @Nullable propagated to getter + builder param
}

After Delombok, JADEx sees and analyzes the generated code:

// Lombok-generated — JADEx propagates @Nullable into these
@Nullable
public String getEmail() { return this.email; }

public UserBuilder email(@Nullable final String email) { ... }
public UserBuilder address(@Nullable final Address address) { ... }

2. Gradle plugin published

The JADEx Gradle plugin is now on Maven Central and the Gradle Plugin Portal.

plugins {
    id 'io.github.nieuwmijnleven.jadex' version '0.628'
}

jadex {
    sourceDir = 'src/main/jadex'
}

That's the only change needed to an existing Spring Boot project. Everything else (compilation, Delombok pipeline, .java generation) is handled automatically.


3. JADEx Spring Boot example project


We highly welcome your feedback on JADEx.

Thank you.

14 Upvotes

6 comments sorted by

View all comments

Show parent comment

2

u/Delicious_Detail_547 Apr 02 '26

Q: Shouldn’t we just wait for Project Valhalla?

A: Valhalla is the future of the JVM and JADEx lets you experience Valhalla-style null-safety in today’s Java.

However, JADEx is not a temporary workaround while waiting for Valhalla. It is a tool that remains valuable even after Valhalla arrives.

From a null-safety perspective, the key difference is this:

  • Valhalla helps you avoid null. it does not eliminate null.
  • JADEx makes NPEs structurally impossible to write.
ValhallaJADEx
Defaultnullablenon-null
Primary goalPerformance / modelingNPE elimination
Target codeMostly new codeLegacy code
Null-safe operators❌?., ?:
Gradual adoptionLimitedCore design principle
Output focusBytecodeHuman-readable Java

Even after Valhalla ships:

String s = foo();
s.length();

This code will still:

  • Compile successfully
  • Potentially crash at runtime
  • Exist across billions of lines of legacy Java

Valhalla does not infer or enforce null contracts in existing APIs.

In JADEx,

String s = foo(); // compile-time error if foo() is nullable

The problem surfaces at authoring time, not in production.


Q: How is this different from Valhalla’s non-null types?

A: ① Valhalla’s non-null is opt-in and conservative

Point! p;
  • Developers must explicitly opt in
  • Data-flow analysis is limited
  • It does not change Java as a whole

👉 The default is still nullable

In other words, Valhalla introduces non-null selectively, without redefining Java’s baseline assumptions.

② JADEx is non-null by default

String name;    // non-null
String? nick;   // nullable

This difference is immediately noticeable in daily development.

“Java, where every type must be doubted” vs. “JADEx, where you only add ? when you actually mean nullable”


Q: Can Valhalla and JADEx Be Used Together?

A: Absolutely. In fact, they are an ideal combination.

1. Clear Separation of Responsibilities

  • Project Valhalla

    • Evolves the JVM’s runtime and memory model
    • Introduces value-based objects for better performance
    • Supports enhanced type annotations, such as nonnull, at the JVM level
  • JADEx

    • Enhances null-safety and type safety at the source code level
    • Generates plain Java code that is fully compatible with existing JVM features

2. Why They Work Well Together

  • No conflicts arise between Valhalla and JADEx; they operate at different layers:

    • Valhalla → runtime and memory optimizations (JVM Level)
    • JADEx → source-level null-safety and expressiveness (Source Code Level)
  • After Valhalla is released, JADEx-generated code can include Valhalla’s nonnull annotations automatically.

    • This means that developers gain clear, explicit information about which types are nullable or non-nullable directly in the source code.

    • As a result, developers can write safer and more predictable code, confidently knowing which variables can or cannot be null, without extra manual annotations or runtime checks.

  • Neither project replaces the other; instead, they complement each other, improving both performance and developer productivity.