this post was submitted on 26 Feb 2026
9 points (100.0% liked)

Programming

25806 readers
86 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 2 years ago
MODERATORS
 

JADEx (Java Advanced Development Extension) is a safety layer that runs on top of Java.
It currently supports up to Java 25 syntax and extends it with additional Null-Safety and Immutability features.

In the previous article, I introduced the Null-Safety features.
For more details, please refer to:


Introducing the New Immutability Feature

If Null-Safety eliminates runtime crashes caused by null,
Immutability reduces bugs caused by unintended state changes.

With v0.41 release, JADEx introduces Immutable by Default Mode


Core Concepts

The Immutability feature revolves around two simple additions:

apply immutability;
mutable

apply immutability;

  • When you declare this at the top of your source file:

    • All fields
    • All local variables (excluding method parameters)
    • are treated as immutable by default.
  • When the JADEx compiler generates Java code:

    • They are automatically declared as final.

mutable keyword

  • Only variables declared with mutable remain changeable.
  • Everything else (excluding method parameters) is immutable by default.

JADEx Source Code


package jadex.example;

apply immutability;

public class Immutability {

    private int capacity = 2; // immutable
    private String msg = "immutable"; // immutable

    private int uninitializedCapacity; // uninitialaized immutable
    private String uninitializedMsg; // uninitialaized immutable

    private mutable String mutableMsg = "mutable";  // mutable

    public static void main(String[] args) {
        var immutable = new Immutability();

         immutable.capacity = 10; //error
         immutable.msg = "new immutable"; //error

         immutable.mutableMsg = "changed mutable";

        System.out.println("mutableMsg: " + immutable.mutableMsg);
        System.out.println("capacity: " + immutable.capacity);
        System.out.println("msg: " + immutable.msg);
    }
}

Generated Java Code

package jadex.example;

//apply immutability;

public class Immutability {

    private final int capacity = 2; // immutable
    private final String msg = "immutable"; // immutable

    private final int uninitializedCapacity; // uninitialaized immutable
    private final String uninitializedMsg; // uninitialaized immutable

    private String mutableMsg = "mutable";  // mutable

    public static void main(String[] args) {
        final var immutable = new Immutability();

         immutable.capacity = 10; //error
         immutable.msg = "new immutable"; //error

         immutable.mutableMsg = "changed mutable";

        System.out.println("mutableMsg: " + immutable.mutableMsg);
        System.out.println("capacity: " + immutable.capacity);
        System.out.println("msg: " + immutable.msg);
    }
}

This feature is available starting from JADEx v0.41. Since the IntelliJ Plugin for JADEx v0.41 has not yet been published on the JetBrains Marketplace, if you wish to try it, please download the JADEx IntelliJ Plugin from the link below and install it manually.

JADEx v0.41 IntelliJ Plugin

We highly welcome your feedback on the newly added Immutability feature.

Finally, your support is a great help in keeping this project alive and thriving.

Thank you.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] FrostyPolicy@suppo.fi 2 points 2 days ago (1 children)

Based on the readme this basically brings some Kotlin null handling and immutability as an add-on to Java projects. For a fresh project I recommend Kotlin. For an existing project this might add some value.

As for immutability Java already has options for that like the final keyword or immutable collections.

Overall an interesting idea. NPEs are way too common in Java code. Even the original creator of null feels it was a mistake to begin with.

JADEx is a solution designed to enhance null-safety in Java. Its key advantage is that existing Java developers can gain null-safety and immutability without any learning curve. As a result, compared to migrating to Kotlin, JADEx offers a much more cost-effective way to significantly improve the stability of the legacy Java codebases that many companies continue to operate.

In addition, JADEx provides immutability, allowing developers to strengthen immutability without the verbose use of the final keyword.