On Wednesday, 9 July 2014 at 17:01:02 UTC, bearophile wrote:
Dicebot:
I don't know where it comes from but non-nullable reference
type has ZERO value if it is not the default one.
This article talks about switching to NotNull on default in
real (small) Java projects (you have to add a @NonNullByDefault
at package level to change the default):
http://blog2.vorburger.ch/2014/07/java-8-null-type-annotations-in-eclipse.html
Bye,
bearophile
I've used the Eclipse annotations with some success when writing
Java code, which I do primarily for Android these days. If we
were to ever transition to non nullable references by default,
annotations would be a good way to make that transition. @notnull
can be used to disallow setting null on references, so it can
check for things like initialising a non-nullable reference in a
constructor. @nullable would available for doing what is already
true for references. Then Option(T) could be available as a
library solution, which can hold a @nullable inside it and
perform the necessary runtime checking and casting to @notnull T.
Then you put things through a long deprecation cycle and the
billion dollar mistake is finally corrected.
There's a pipedream, anyway.