New candidate JEP: 506: Scoped Values

Alan Bateman alan.bateman at oracle.com
Wed Apr 16 14:53:41 UTC 2025


On 16/04/2025 15:43, Adam Gent wrote:
> :
>
> You see orElse on `Optional` which is what people are familiar with and what I think is confusing given it has the same name is known in static analysis world of `PolyNull` where if I pass in `null` I'm going to get `null` back regardless of the container generic type.
The proposal is that ScopedValue.orElse(T) doesn't accept null [1] so 
different to Optional.orElse. When null restricted types come then the 
hope is that it can change orElse(T!).

-Alan

[1] 
https://download.java.net/java/early_access/loom/docs/api/java.base/java/lang/ScopedValue.html#orElse(T)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/loom-dev/attachments/20250416/4150e77e/attachment.htm>


More information about the loom-dev mailing list