Type primitive pattern: the problem with primitive and boxing
Brian Goetz
brian.goetz at oracle.com
Thu Sep 11 17:37:01 UTC 2025
I'm going to pend this thread until the other thread is resolved; I
think whatever issue is confounding the other is likely to confuse this
one as well.
On 9/11/2025 10:52 AM, Remi Forax wrote:
> Following Brian and Dan comments, I restart several different threads.
>
> The way JEP 507 semantics is defined does not work well with the idea that int can be seen as a subtype of Integer, or at least seen int and Integer! as interoperable.
>
> For example, this code compile
> int v = ...
> switch(v) {
> case byte b -> ...
> case int i -> ...
> }
>
> But this code does not compile
> Integer v = ...
> switch(v) {
> case byte b -> ...
> case int i -> ...
> }
>
> so at best there is a risk of making our lives (the Valhalla EG) miserable in the future because of the semantics of this JEP, at worst, in the future, people will declare the component of their records either as an Integer! or as an int to get the flavor of pattern matching they want.
>
> regards,
> Rémi
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-observers/attachments/20250911/2025fdcf/attachment.htm>
More information about the amber-spec-observers
mailing list