๐ŸŒ
Oracle
oracle.com โ€บ java โ€บ technical details
Tired of Null Pointer Exceptions? Consider Using Java SE 8's Optional!
Scala has a similar construct called Option[T] to encapsulate the presence or absence of a value of type T. You then have to explicitly check whether a value is present or not using operations available on the Option type, which enforces the idea of "null checking." You can no longer "forget to do it" because it is enforced by the type system. OK, we diverged a bit and all this sounds fairly abstract. You might now wonder, "so, what about Java SE 8?"
๐ŸŒ
Baeldung
baeldung.com โ€บ home โ€บ java โ€บ avoid check for null statement in java
Avoid Check for Null Statement in Java | Baeldung
January 8, 2024 - Here, @NonNull makes it clear that the argument cannot be null. If the client code calls this method without checking the argument for null, FindBugs would generate a warning at compile time. Developers generally rely on IDEs for writing Java code.
Discussions

Null safety
don't construct objects in invalid states; do throw exceptions in constructors enforce pre-conditions and invariants leverage the type system of the language model finite state machines where types are states and method calls are state transitions throw exceptions in constructors if a null is passed when it shouldn't More on reddit.com
๐ŸŒ r/java
229
100
August 13, 2024
Draft JEP: Null-Restricted and Nullable Types (Preview)
Finally. Finally? Finally! More on reddit.com
๐ŸŒ r/java
247
195
August 2, 2024
Will Project Valhalla bring Kotlin-like nulls to Java?
It's not just having nullable type support. It comes down to usage. There are code bases gaining tech debt, just by having variables declared as nullable type and using ?. Duh, NPE solved. Original intent of avoiding nullable type as much as possible is unfortunately missed. More on reddit.com
๐ŸŒ r/Kotlin
65
24
November 2, 2022
Retrofitting null-safety onto Java at Meta
Null safety usage should be enforced (or warned) by the Java compiler like some other languages. More on reddit.com
๐ŸŒ r/java
58
112
September 18, 2022
๐ŸŒ
Kotlin
kotlinlang.org โ€บ docs โ€บ null-safety.html
Null safety | Kotlin Documentation
In Java, this would be the equivalent of a NullPointerException, or an NPE for short. Kotlin explicitly supports nullability as part of its type system, meaning you can explicitly declare which variables or properties are allowed to be null. Also, when you declare non-null variables, the compiler enforces that these variables cannot hold a null value, preventing an NPE. Kotlin's null safety ensures safer code by catching potential null-related issues at compile time rather than runtime.
๐ŸŒ
heise online
heise.de โ€บ en โ€บ news โ€บ Spring-Framework-7-brings-new-concept-for-null-safety-and-relies-on-Java-25-11078745.html
Spring Framework 7 brings new concept for null safety and relies on Java 25 | heise online
3 weeks ago - This makes the previous annotations according to JSR 305 (Java Specification Request) obsolete (deprecated). JSpecify provides annotations that help prevent null pointer errors: @Nullable indicates that the value can potentially be null, while types annotated with @NonNull must never be null.
๐ŸŒ
Spring
spring.io โ€บ blog โ€บ 2025 โ€บ 11 โ€บ 12 โ€บ null-safe-applications-with-spring-boot-4
Null-safe applications with Spring Boot 4
3 weeks ago - The easiest way to benefit from Spring null-safety is to upgrade to Spring Boot 4 and use an IDE that supports JSpecify annotations to provide feedback to the developer on how to handle potential nullability issues detected from Spring APIs usage.

in object-oriented programming, a guarantee that no object references will have null values

Void safety (also known as null safety) is a guarantee within an object-oriented programming language that no object references will have null or void values. In object-oriented languages, access to objects is โ€ฆ Wikipedia
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ Void_safety
Void safety - Wikipedia
October 1, 2025 - At execution time, however, a reference can be void (or null). In such cases, the call above will be a void call, leading to a run-time exception, often resulting in abnormal termination of the program. Void safety is a static (compile-time) guarantee that a void call will never arise.
๐ŸŒ
Quora
quora.com โ€บ Why-is-Java-still-missing-null-safety
Why is Java still missing null safety? - Quora
Answer (1 of 4): Good question. Java is safer than C++ in this respect; NullPointerException at least does not crash the process in the OS. Java 8 Optional has given us a bit more for streams and method returns, but is still not quite there for representing values that might not be there. You ...
Find elsewhere
๐ŸŒ
Viralpatel
viralpatel.net โ€บ null-safe-type-java-7-nullpointerexception
Null-safe Type in Java 7: New way to handle NullPointerException
October 9, 2009 - Also, during debugging, it would make it difficult to know which value is null. ... Yes, it was rejected. Whilst it makes sense in Groovy, when actually tried out with real Java codebases as part of project coin testing, it didnt work so well compared to the Groovy implementation.
๐ŸŒ
Kotlin
kotlinlang.org โ€บ docs โ€บ java-to-kotlin-nullability-guide.html
Nullability in Java and Kotlin | Kotlin Documentation
1 month ago - When a variable contains null, an attempt to dereference the variable leads to a NullPointerException. There are many ways to write code in order to minimize the probability of receiving null pointer exceptions. This guide covers differences between Java's and Kotlin's approaches to handling possibly nullable variables.
๐ŸŒ
DEV Community
dev.to โ€บ cheol_jeon_9e29b98fdb7e1e โ€บ jplus-a-java-superset-with-null-safety-and-boilerplate-elimination-46md
JPlus โ€“ A Java Superset with Null Safety and Boilerplate Elimination - DEV Community
October 22, 2025 - JPlus code compiles to standard JVM bytecode, enabling full use of Java libraries and frameworks. JPlus enforces strict null checks at compile-time and introduces Kotlin-style operators:
๐ŸŒ
DEV Community
dev.to โ€บ headf1rst โ€บ solving-the-billion-dollar-mistake-modern-java-null-safety-with-jspecify-and-nullaway-2ie7
Solving the Billion-Dollar Mistake: Modern Java Null Safety with JSpecify and NullAway - DEV Community
September 24, 2025 - The fundamental problem in Java is that nullability is implicit. Unless explicitly stated in API documentation, developers can't be sure whether a return value can be null, leading to misunderstandings and bugs. To solve this problem, teams from Google, JetBrains, Spring, and others collaborated to create the JSpecify standard. JSpecify is more than just a set of annotations; it provides a clear specification for null safety, ensuring consistent behavior across tools like IDEs and static analyzers.
๐ŸŒ
Javaplanet
javaplanet.io โ€บ java-core โ€บ java-generics โ€บ type-safety-and-avoiding-unchecked-warnings
Type Safety and Avoiding Unchecked Warnings
September 6, 2025 - Passing null where an object is required ยท Detected at runtime: Unlike checked exceptions, these are not enforced by the compiler. No need for throws clause: Code that might throw unchecked exceptions doesnโ€™t need to declare or catch them. Design philosophy: Java encourages using unchecked exceptions for programming errors and checked exceptions for recoverable conditions. Though seemingly separate, type safety helps prevent unchecked exceptions like ClassCastException at runtime.
๐ŸŒ
Medium
tamerardal.medium.com โ€บ null-safety-avoid-null-pointer-exception-in-java-3cd623693418
Null Safety: Avoid Null Pointer Exception in Java | by Tamer Ardal | Medium
October 17, 2024 - Whether you use traditional checks, Optional, or the Objects class, you can write code that is both readable and safe from null pointer exceptions. By leveraging these standard Java features, you can keep your codebase lightweight and maintainable without relying on third-party dependencies.
๐ŸŒ
DEV Community
dev.to โ€บ nfrankel โ€บ null-safety-kotlin-vs-java-13pn
Null safety: Kotlin vs. Java - DEV Community
February 16, 2023 - Developers praise Kotlin for its null-safety: it's the result of its null-handling mechanism baked into the language design. Java will never be able to compete with Kotlin in this regard, as Java language architects value backward compatibility over code safety.
๐ŸŒ
Spring
docs.spring.io โ€บ spring-framework โ€บ reference โ€บ core โ€บ null-safety.html
Null-safety :: Spring Framework
Although Java does not let you express nullness markers with its type system yet, the Spring Framework codebase is annotated with JSpecify annotations to declare the nullability of its APIs, fields, and related type usages. Reading the JSpecify user guide is highly recommended in order to get familiar with those annotations and semantics. The primary goal of this null-safety arrangement is to prevent a NullPointerException from being thrown at runtime via build time checks and to use explicit nullability as a way to express the possible absence of value.
๐ŸŒ
Spring
spring.io โ€บ blog โ€บ 2025 โ€บ 03 โ€บ 10 โ€บ null-safety-in-spring-apps-with-jspecify-and-null-away
Null Safety in Spring applications with JSpecify and NullAway
March 10, 2025 - JSpecify is a set of annotations, specifications and documentation designed to ensure the null safety of Java applications and libraries in the IDE or during the compilation thanks to tools like NullAway.
๐ŸŒ
Medium
medium.com โ€บ @ksaquib โ€บ mastering-java-8s-optional-t-a-guide-to-null-safety-74dfe63bb292
Mastering Java 8โ€™s Optional<T>: A Guide to Null Safety | by Saquib Khan | Medium
April 30, 2024 - Java 8 introduced a powerful new class called Optional<T> aimed at combating these exceptions by encouraging developers to handle the absence of values more gracefully. Optional<T> is a container object used to represent a value that is either present or absent. It provides a clear and explicit way to deal with the absence of a value, rather than relying on null, thus helping avoid NullPointerExceptions.
๐ŸŒ
DEV Community
dev.to โ€บ rytheturtle โ€บ null-safety-in-java-3mde
Null Safety In Java - DEV Community
February 11, 2024 - Introduced in Java 1.8, the Optional class gives a null safe standard library class for Java developers to express that a value may or may not be present. Null safety is an important characteristic of code, so much so that null safety is a first class feature of many newer programming languages.
๐ŸŒ
FB
engineering.fb.com โ€บ home โ€บ retrofitting null-safety onto java at meta
Retrofitting null-safety onto Java at Meta
November 22, 2022 - We developed a new static analysis tool called Nullsafe that is used at Meta to detect NullPointerException (NPE) errors in Java code. Interoperability with legacy code and gradual deployment model were key to Nullsafeโ€™s wide adoption and allowed us to recover some null-safety properties in the context of an otherwise null-unsafe language in a multimillion-line codebase.