top | item 37539198

(no title)

leapis | 2 years ago

Nullable is a huge issue in Java, but annotation-based nullability frameworks are both effective and pervasive in the ecosystem (and almost mandatory, IMO).

I'm really excited about https://jspecify.dev/, which is an effort by Google, Meta, Microsoft, etc to standardize annotations, starting with @Nullable.

discuss

order

kaashif|2 years ago

This can never be as effective as changing the default reference type to be not nullable, which would break backwards compatibility, so you can never really relax.

I know Kotlin is basically supposed to be that, it has a lot of other stuff though, and I haven't used it much.

martindevans|2 years ago

That's basically what c# has done. But it's implemented as a warning which can be upgraded to an error. I think it might even be an error by default in new projects now.

wayfinder|2 years ago

I hope they succeed. So many people have tried.

mrkeen|2 years ago

Not having nulls is easy.

Persuading Java devs not to use nulls is hard.

netheril96|2 years ago

Nullable annotations don’t work with well with generics, or at least those tools I use.