3 ms·
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/
by MrBuddyCasino 4y ago
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 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:
class Cursor {
private Point! position;
}
- jfengel 4y agoI'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.