I found this while looking around Project Valhalla. You'll have to ctrl+f for "Use of null-restricted types", as the linked dedicated page (https://openjdk.org/jeps/8303099) for that feature is 404.
Proposed syntax is the opposite of Kotlin, where everything is non-null by default but can be made nullable by adding a "?", eg "val s: String? = null".
The Java version instead looks like this, where you add an exclamation mark to mark it as non-nullable:
I'd really like that. I don't feel compelled to change my tool chain in order to use Kotlin, but fixing the billion-dollar mistake is something Java really needs.
I suppose backwards compatibility means things need to be nullable by default. That's fine, even if it means that the vast majority of my code would be declared with a bang.
It sounds like we're a long way from getting it, though.
If I'm reading this correctly, it's basically saying if you have a variable, who's type is a Value Object (roughyl equivalent to a Basic type, lets say a long), then you may disallow null for this variable?
If Value Types are supposed to be equivalents of Java Basic types, I would have expected this to be the only way they work. Sort of surprised to see this, so I'm probably missing something important.
Proposed syntax is the opposite of Kotlin, where everything is non-null by default but can be made nullable by adding a "?", eg "val s: String? = null".
The Java version instead looks like this, where you add an exclamation mark to mark it as non-nullable: