Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8312230 | 22 | Angelos Bimpoudis | P3 | Resolved | Fixed | b07 |
JDK-8312954 | 21.0.1 | Angelos Bimpoudis | P3 | Resolved | Fixed | b04 |
Description
public class Bug {
sealed interface A permits B {}
record B() implements A {}
record Rec(A a, A b) {}
public void test(Rec r)
{
switch (r) {
case Rec(_, B()): break;
case Rec(_, _):
}
}
}
produces:
An exception has occurred in the compiler (22-internal). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://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: Unknown pattern: ANYPATTERN
at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:162)
at jdk.compiler/com.sun.tools.javac.comp.Check.patternDominated(Check.java:4759)
at jdk.compiler/com.sun.tools.javac.comp.Check.patternDominated(Check.java:4748)
at jdk.compiler/com.sun.tools.javac.comp.Check.checkSwitchCaseLabelDominated(Check.java:4703)
at jdk.compiler/com.sun.tools.javac.comp.Attr.handleSwitch(Attr.java:1854)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSwitch(Attr.java:1605)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1299)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:755)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1439)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1092)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1229)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:916)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5648)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5536)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5360)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5299)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1365)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:978)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:66)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)
printing javac parameters to: /Users/bibou/dev/jdk/build/macosx-aarch64-server-release/JTwork/scratch/javac.20230717_112156.args
result: Error. compiler crashed (exit code 4)
sealed interface A permits B {}
record B() implements A {}
record Rec(A a, A b) {}
public void test(Rec r)
{
switch (r) {
case Rec(_, B()): break;
case Rec(_, _):
}
}
}
produces:
An exception has occurred in the compiler (22-internal). Please file a bug against the Java compiler via the Java bug reporting page (https://bugreport.java.com) after checking the Bug Database (https://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: Unknown pattern: ANYPATTERN
at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:162)
at jdk.compiler/com.sun.tools.javac.comp.Check.patternDominated(Check.java:4759)
at jdk.compiler/com.sun.tools.javac.comp.Check.patternDominated(Check.java:4748)
at jdk.compiler/com.sun.tools.javac.comp.Check.checkSwitchCaseLabelDominated(Check.java:4703)
at jdk.compiler/com.sun.tools.javac.comp.Attr.handleSwitch(Attr.java:1854)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSwitch(Attr.java:1605)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1299)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:755)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1439)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1092)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1229)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:916)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:662)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:736)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:5648)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5536)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:5360)
at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:5299)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1365)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:978)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:319)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:178)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:66)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:52)
printing javac parameters to: /Users/bibou/dev/jdk/build/macosx-aarch64-server-release/JTwork/scratch/javac.20230717_112156.args
result: Error. compiler crashed (exit code 4)
Attachments
Issue Links
- backported by
-
JDK-8312230 Crash in dominance check when compiling unnamed patterns
-
- Resolved
-
-
JDK-8312954 Crash in dominance check when compiling unnamed patterns
-
- Resolved
-
- links to
-
Commit openjdk/jdk21/48760d7a
-
Commit openjdk/jdk/1fc726a8
-
Review openjdk/jdk21/134
-
Review openjdk/jdk/14912
(1 links to)