New candidate JEP: 506: Scoped Values
Adam Gent
dev at adamgent.com
Wed Apr 16 17:35:57 UTC 2025
On Wed, Apr 16, 2025, at 10:53 AM, Alan Bateman wrote:
> 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)
Oh darn it i was looking at the wrong Javadoc. I was looking at: https://download.java.net/java/early_access/jdk25/docs/api/java.base/java/lang/ScopedValue.html#orElse(T)
I forgot the loom fork. I guess that indeed changes things for the better.
More information about the loom-dev
mailing list