Feature Request for Primitive Patterns (JEP 455)

David Alayachew davidalayachew at gmail.com
Mon Sep 25 21:02:45 UTC 2023


Hello Amber Dev Team,

I have a feature request to be included as part of JEP 455 -- Primitive
Patterns.

> Since the boolean type (and its corresponding boxed type)
> has only two distinct values, a switch that lists both
> the true and false cases is considered exhaustive:
>
> boolean b = ...
> switch (b) {
>   case true -> ...
>   case false -> ...
>   // Alternatively: case true, false -> ...
> }
>
> It is a compile-time error for this switch to include a
> default clause.

I formally request that this functionality be extended to the primitive
type byte.

Thank you for your time and help!
David Alayachew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-dev/attachments/20230925/ae2d9ace/attachment.htm>


More information about the amber-dev mailing list