On the last case being explicitly total

Guy Steele guy.steele at oracle.com
Tue Aug 11 22:18:53 UTC 2020



> On Aug 11, 2020, at 6:12 PM, Brian Goetz <brian.goetz at oracle.com> wrote:
> . . .
> 
> or, with a smaller hammer:
> 
>     switch (multiBox) {
>         case MultiBox(String a, String b, String c): ...
>         case MultiBox(Integer a, Integer b, Integer c): ...
>         final case MultiBox(Object a, Object b, Object c): ...
>     }
> 
> where `final case` would mean "this covers it all, its an error if it doesn't.” 

Looks like we independently came upon the same thing literally within seconds of each other.  :-)

Which of course is not evidence either for or against its being a good idea.



More information about the amber-spec-experts mailing list