Historically, we have rarely intentionally thrown a NullPointerException in the Spring Framework. Instead, we prefer to throw either an IllegalArgumentException or IllegalStateException instead of a NullPointerException. However, changes to the code in recent times have introduced the use of Objects.requireNonNull(Object) which throws a NullPointerException without an explicit error message. The latter ends up providing less context than a NullPointerException thrown by the JVM (since Java 14) due to actually de-referencing a null-pointer. See https://openjdk.org/jeps/358. In light of that, this commit revises our current use of Objects.requireNonNull(Object) by removing it or replacing it with Assert.notNull(). However, we still use Objects.requireNonNull(T, String) in a few places where we are required to throw a NullPointerException in order to comply with a third-party contract such as Reactive Streams. Closes gh-32430 |
||
|---|---|---|
| .. | ||
| src | ||
| spring-core.gradle | ||