Re:Java 17 / JDK 17: General Availability
by derefr on Tuesday September 14, 2021 @11:45AM
(#28526519)
Who said anything about non-primitive value types? Java just needs a second kind of reference type: non-nullable reference types that are always initialized, where a direct assignment from a nullable-reference-typed value to a non-nullable-reference-typed slot fails to compile (but the opposite succeeds.) You’d instead have to go through Optional.ofNullable or somesuch, where that proxy type would then be modified to have variants of .get et al that return a non-nullable-reference return type.
[ Parent
| on HN ]
There are no comments on this comment yet.