I've been building JADEx — a source-to-source compiler that adds two things Java has always been missing: null-safety and final-by-default semantics. No JVM changes, no runtime dependency, just safer Java.
The problem
If you've worked on a large Spring Boot codebase, you've seen this everywhere:
public String getUsername(User user) {
if (user == null) return null;
if (user.getProfile() == null) return null;
return user.getProfile().getUsername();
}
The usual options:
-
@NonNull/@Nullableannotations — opt-in, unenforced at the language level - Migrate to Kotlin — cost-prohibitive for large, widely-used legacy Java codebases
What JADEx does: Null-Safety
JADEx introduces .jadex source files. Non-null is the default. Type? is the explicit opt-in for nullable.
// UserService.jadex
public String? getUsername(User? user) {
return user?.profile?.username;
}
The ?. operator chains safely. The ?: Elvis operator provides a fallback:
String? name = repository.findName(id);
String display = name?.toUpperCase() ?: "UNKNOWN";
If you try to access a nullable variable without ?., the compiler stops you. Null bugs shift from runtime crashes to compile-time feedback.
What JADEx does: Final-by-Default
The second feature is readonly mode — one directive makes fields, local variables, and parameters final by default:
apply readonly;
public class OrderService {
private int total = 0; // final — accidental reassignment is a compile error
private mutable int retries; // explicitly mutable when you need it
}
In large codebases, accidental reassignment is a silent bug category that final fixes — but Java requires you to write it everywhere manually, so nobody does. JADEx inverts the default.
It works in real Spring Boot projects
These aren't just toy examples. JADEx has a full Spring Boot CRUD example project showing both features working together across controllers, services, and repositories — the kind of layered architecture where null propagation and mutable state cause the most damage in practice.
The generated output is plain Java with JSpecify annotations, so it's fully compatible with NullAway, Checker Framework, and everything else in the ecosystem.
- Full description: JADEx Spring Boot Example
- Source repository: jadex-springboot-example
Who is JADEx for?
JADEx is a solution designed to enhance null-safety in existing Java codebases. Its key advantage is that Java developers can adopt null-safety and final-by-default semantics with zero learning curve. For the large legacy Java codebases that many companies continue to operate, migrating everything to Kotlin is rarely cost-effective — JADEx offers a much more practical path to meaningfully improving codebase stability without abandoning the investment already made in Java.
Links
- GitHub: github.com/nieuwmijnleven/JADEx
- Tutorial: Making Your Java Code Null-Safe without Rewriting it
- Real-world example: Applying JADEx to a Real Java Project
- Spring Boot example: Full description · Source repository
Gradle plugin is on Gradle Plugin Portal. IntelliJ plugin available separately.
Tony Hoare called null his "billion-dollar mistake." Java has been paying that bill for more than 25 years. JADEx is one way to stop.
Top comments (0)