5 ms·
They are slowly getting there. See the JEP draft: Null-Restricted Value Class Types (Preview) Source: https://openjdk.org/jeps/8316779 https://openjdk.org/jeps
by DarkNova6 2y ago
They are slowly getting there. See the JEP draft: Null-Restricted Value Class Types (Preview)
Source: https://openjdk.org/jeps/8316779 https://openjdk.org/jeps/8316779
But it is already possible today using the Spring annoation "NonNullApi" on a package level. Then, you can allow nullable fields via @Nullable.
It's not perfectly elegant, but it works surprisingly well.