pattern matching bug

Jan Lahoda jan.lahoda at oracle.com
Thu Oct 25 16:17:56 UTC 2018


Hi Remi,

Thanks for the report. I've filled this as:
https://bugs.openjdk.java.net/browse/JDK-8212982

I believe this program should not compile (for switch expressions with 
rule cases, the case shouldn't complete normally).

Jan

On 24.10.2018 12:08, Remi Forax wrote:
> Using the amber-demo branch, this code prints bug *and* temp :)
> Again this bug was found by Francois Green.
>
> public class SwitchBug {
>
>      static String hold(String item) -> switch(item) {
>        case String s -> { System.out.println(s); }
>        default -> "temp";
>      }
>
>      public static void main(String[] args) {
>          System.out.println(hold("bug"));
>      }
> }
>
> Rémi
>


More information about the amber-dev mailing list