Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8270046 | 18 | Jan Lahoda | P3 | Resolved | Fixed | b06 |
JDK-8270722 | 17.0.1 | Jan Lahoda | P3 | Resolved | Fixed | b03 |
Consider the following code:
---
public class T {
void t() {
Object o = null;
switch (o) {
default -> {
switch (o) {
case String s -> System.out.println(s);
default -> {}
}
}
}
}
}
---
This fails to compile:
---
$ javac --enable-preview -source 17 T.java
Note: T.java uses preview features of Java SE 17.
Note: Recompile with -Xlint:preview for details.
An exception has occurred in the compiler (17-internal). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.AssertionError
at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.handleSwitch(Gen.java:1310)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSwitch(Gen.java:1193)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1294)
---
---
public class T {
void t() {
Object o = null;
switch (o) {
default -> {
switch (o) {
case String s -> System.out.println(s);
default -> {}
}
}
}
}
}
---
This fails to compile:
---
$ javac --enable-preview -source 17 T.java
Note: T.java uses preview features of Java SE 17.
Note: Recompile with -Xlint:preview for details.
An exception has occurred in the compiler (17-internal). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
java.lang.AssertionError
at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.handleSwitch(Gen.java:1310)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSwitch(Gen.java:1193)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1294)
---
- backported by
-
JDK-8270046 javac fails to compile nested pattern matching switches
- Resolved
-
JDK-8270722 javac fails to compile nested pattern matching switches
- Resolved