-
Bug
-
Resolution: Fixed
-
P2
-
12
-
b21
-
Verified
As reported here:
http://mail.openjdk.java.net/pipermail/amber-dev/2018-October/003601.html
This code:
---
public class SwitchBug {
static String hold(String item) {
return switch(item) {
case String s -> { System.out.println(s); }
default -> "temp";
};
}
public static void main(String[] args) {
System.out.println(hold("bug"));
}
}
---
compiles and produces:
---
bug
temp
---
This program should not compile, as the first case completes normally.
http://mail.openjdk.java.net/pipermail/amber-dev/2018-October/003601.html
This code:
---
public class SwitchBug {
static String hold(String item) {
return switch(item) {
case String s -> { System.out.println(s); }
default -> "temp";
};
}
public static void main(String[] args) {
System.out.println(hold("bug"));
}
}
---
compiles and produces:
---
bug
temp
---
This program should not compile, as the first case completes normally.