-
Bug
-
Resolution: Fixed
-
P3
-
17, 21, 22
-
b02
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8323309 | 22.0.1 | Jan Lahoda | P3 | Resolved | Fixed | b02 |
JDK-8323062 | 22 | Jan Lahoda | P3 | Resolved | Fixed | b31 |
JDK-8323773 | 21.0.3-oracle | Jan Lahoda | P3 | Resolved | Fixed | b02 |
JDK-8323737 | 21.0.3 | Aleksey Shipilev | P3 | Resolved | Fixed | b01 |
---
public class SwitchPrimitive {
private void test(String s) {
Class<?> c = switch (s) {
case "": yield int.class;
default: yield null;
};
}
}
---
This fails with:
---
$ javac /tmp/SwitchPrimitive.java
/tmp/SwitchPrimitive.java:4: error: not a statement
case "": yield int.class;
^
/tmp/SwitchPrimitive.java:4: error: ';' expected
case "": yield int.class;
^
/tmp/SwitchPrimitive.java:4: error: not a statement
case "": yield int.class;
^
3 errors
---
while it should compile without errors.
- backported by
-
JDK-8323062 yield <primitive-type>.class not parsed correctly.
- Resolved
-
JDK-8323309 yield <primitive-type>.class not parsed correctly.
- Resolved
-
JDK-8323737 yield <primitive-type>.class not parsed correctly.
- Resolved
-
JDK-8323773 yield <primitive-type>.class not parsed correctly.
- Resolved
- links to
-
Commit openjdk/jdk21u-dev/e08eb0ec
-
Commit openjdk/jdk22/bb0e203d
-
Commit openjdk/jdk/ce8399fd
-
Review openjdk/jdk21u-dev/128
-
Review openjdk/jdk22/6
-
Review openjdk/jdk/17035