StableValue vs Optional

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Jun 17 15:05:36 UTC 2025


On 17/06/2025 16:01, Mickael Istria wrote:
>
>
> On Tue, Jun 17, 2025 at 4:51 PM Maurizio Cimadamore 
> <maurizio.cimadamore at oracle.com> wrote:
>
>     Maybe I'm misunderstanding... what would be the difference between
>     StableValue::supplier and Supplier::cache ?
>
>     Is it a discoverability issue you are pointing out (e.g. this
>     factory would be more discoverable if it belonged to Supplier --
>     which is something we flipped-flopped several times about) or is
>     there more, e.g. a semantics distinction?
>
> It's me who misunderstood: I misread StableValue::supplier signature 
> and had thought it would return a StableValue. And that is wrong, it 
> does indeed return a Supplier, my bad!
> So I suspect the issue I faced is more an issue of discoverability or 
> consistency with existing APIs then: if I want a Supplier, the first 
> thing I'd try is to use my IDE to complete Supplier.| , I don't think 
> I would easily think of completng StableValue.| to get a Supplier.

Thanks for confirming. And this (e.g. location of factory methods) is 
indeed something that we might revisit in the second round of preview of 
this API.

Cheers
Maurizio

>
>
> -- 
> Mickael Istria
> Eclipse IDE 
> <https://urldefense.com/v3/__https://www.eclipse.org/eclipseide__;!!ACWV5N9M2RV99hQ!KwFyqDqtRLzFJU64SP8K6gAV3Ei3QVWcw7YA3_LCkKtMCgVWv_6hYnqnOJ-34wj1qtxrh8ODNXo8vKvbhtcCfEg$> 
> developer, for Red Hat 
> <https://urldefense.com/v3/__https://developers.redhat.com/__;!!ACWV5N9M2RV99hQ!KwFyqDqtRLzFJU64SP8K6gAV3Ei3QVWcw7YA3_LCkKtMCgVWv_6hYnqnOJ-34wj1qtxrh8ODNXo8vKvb40BCHX0$>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20250617/aac1aad7/attachment-0001.htm>


More information about the core-libs-dev mailing list