DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Multithreading in Modern Java: Advanced Benefits and Best Practices
  • Optimizing Java Applications for Arm64 in the Cloud
  • Monitoring Java Microservices on EKS Using New Relic APM and Kubernetes Metrics
  • From Java 8 to Java 21: How the Evolution Changed My Developer Workflow

Trending

  • Stop Writing Dialect-Specific SQL: A Unified Query Builder for Node.js
  • Evaluating SOC Effectiveness Using Detection Coverage and Response Metrics
  • Bridging Gaps in SOC Maturity Using Detection Engineering and Automation
  • Stop Using Python for Your GenAI Apps, Use Go and Genkit Instead
  1. DZone
  2. Coding
  3. Java
  4. JPlus: A Modern Java Superset Language

JPlus: A Modern Java Superset Language

JPlus is a modern Java superset that introduces null-safety and boilerplate code-generation syntax while preserving Java compatibility.

By 
Cheol Jeon user avatar
Cheol Jeon
·
Nov. 05, 25 · Analysis
Likes (2)
Comment
Save
Tweet
Share
3.1K Views

Join the DZone community and get the full member experience.

Join For Free

JPlus is a Java superset language running on the JVM that enhances developer productivity while staying fully compatible with the Java ecosystem.

Why Support JPlus?

JPlus fills a unique gap in the Java ecosystem:

  • Maintains 100% Java syntax compatibility
  • Introduces null safety(?), null-safety operator(?.), boilerplate code generating syntax(apply), and Elvis Operator(?:) features
  • Allows gradual adoption alongside existing Java code
  • Compiles directly to plain Java code

Watch the demo video:


Currently, no other language extends Java in this way while keeping the syntax familiar to Java developers.

Key Features

  • Strict null checking – prevents null reference errors at compile time
  • Null-safety operator – use ?. operators to safely access nullable variables without risking NullPointerException
  • Boilerplate code-generating syntax – replace common boilerplate like getters, setters, constructors, and builders without Lombok
  • Elvis operator – Simplify null checks with ?: to provide default values when a variable is null

Example 1: Combining ?. and ?: Operators

JPlus supports combining the null-safe access operator (?.) and the Elvis operator (?:)
to simplify complex null-handling logic into clean and concise expressions.

Example: NullsafeWithElvisOperator.jplus

Java
 
package jplus.example;

public class Main {
    public static void main(String[] args) {
        String? s1 = null;
        String s2 = s1 ?: "jplus";
        System.out.printf("the length of s1 : %d\n", s1?.length() ?: 0);
        System.out.printf("the length of s2 : %d\n", s2.length());
    }
}


  • s1 is a nullable variable.
  • s1 ?: "jplus" → assigns "jplus" if s1 is null.
  • s1?.length() ?: 0 → safely calls length() on s1, returns 0 if s1 is null.
  • By combining both operators, null handling becomes safe and concise.

Output (Java Code Generated by JPlus)

Java
 
package jplus.example;

public class Main {
    public static void main(String[] args) {
        String s1 = null;
        String s2 = (((s1) != null) ? (s1) : "jplus");
        System.out.printf(
                "the length of s1 : %d\n",
                (((((s1 != null) ? s1.length() : null)) != null)
                        ? (((s1 != null) ? s1.length() : null))
                        : 0));
        System.out.printf("the length of s2 : %d\n", s2.length());
    }
}


The expression s1?.length() ?: 0 is translated into a nested conditional check in Java: ((s1 != null) ? s1.length() : null) != null ? ... : 0, ensuring safe execution.

Example 2: Using Apply for Data Class and Nested Class Boilerplate Elimination

JPlus introduces the apply keyword to replace common Java boilerplate code, such as getters, setters, constructors, builders, and more. It serves as a language-level alternative to Lombok annotations, offering a clean and declarative syntax.

Example: ApplyStatement.jplus

Java
 
package com.example;

apply data, constructor(required, all, no), builder;
apply {
    User.Profile: getter, setter, equality, constructor(all);
}

public class User {
    private String name;
    private int age;

    public class Profile {
        String nickname;
    }
}


  • data: Automatically generates getters, setters, equals(), hashCode(), and toString()
  • builder: Generates a User.Builder class for fluent object creation
  • constructors(required, all, no): Generates a constructor with all/required fields and a no-argument constructor
  • equality: Generates equals() and hashCode() methods
  • apply { User.Profile: ... }: Applies boilerplate generation specifically to the Profile inner class

Output (Java Code Generated by JPlus)

Java
 
package com.example;

//apply data, constructor(required, all, no), builder;
//apply {
//    User.Profile: getter, setter, equality, constructor(all);
//}

public class User {
    private String name;
    private int age;

    public User(String name, int age) {
        this.name = name;
        this.age = age;
    }

    public User() {}

    public class Profile {
        String nickname;

        public Profile(String nickname) {
            this.nickname = nickname;
        }

        public String getNickname() {
            return nickname;
        }

        public void setNickname(String nickname) {
            this.nickname = nickname;
        }

        @Override
        public boolean equals(Object o) {
            if (this == o) return true;
            if (o == null || getClass() != o.getClass()) return false;
            Profile profile = (Profile) o;
            return java.util.Objects.equals(nickname, profile.nickname);
        }

        @Override
        public int hashCode() {
            return java.util.Objects.hash(nickname);
        }
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "User{" + "name=" + name+ ", " + "age=" + age + "}";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return age == user.age
                && java.util.Objects.equals(name, user.name);
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(name, age);
    }

    public static class Builder {
        private String name;
        private int age;

        public Builder name(String name) {
            this.name = name;
            return this;
        }

        public Builder age(int age) {
            this.age = age;
            return this;
        }

        public User build() {
            return new User(name, age);
        }
    }

    public static Builder builder() {
        return new Builder();
    }
}


This allows developers to keep code DRY and expressive, even with deeply nested structures.

Current Status

  • MVP (Minimum Viable Product) stage
  • IntelliJ Plugin 0.1 MVP Alpha released with:
    • Syntax highlighting, code completion, and error checking
    • Nullability checks
    • Seamless integration with existing Java projects

Resources

  • Github repository
  • intellij-plugin-0.1-mvp-alpha.zip
Boilerplate code Java (programming language) Java virtual machine

Opinions expressed by DZone contributors are their own.

Related

  • Multithreading in Modern Java: Advanced Benefits and Best Practices
  • Optimizing Java Applications for Arm64 in the Cloud
  • Monitoring Java Microservices on EKS Using New Relic APM and Kubernetes Metrics
  • From Java 8 to Java 21: How the Evolution Changed My Developer Workflow

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook