package test;
public class Test {
static abstract class Entree {}
static class Steak extends Entree {}
private static <T> int consume(T t) {
int success = -1;
switch(t) {
case Steak _, Entree _, Object _ : {
success = 1; break;
}
}
return success;
}
public static void main(String argv[]) {
System.out.println(consume(new Steak()));
}
}
An exception has occurred in the compiler (21-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
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:1341)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitSwitch(Gen.java:1224)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:1295)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:614)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:649)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:635)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:686)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.doVisitBlock(Gen.java:1128)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1121)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1088)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:614)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:649)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:635)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStats(Gen.java:686)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.doVisitBlock(Gen.java:1128)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1121)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1088)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:614)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genStat(Gen.java:649)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:975)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:938)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:912)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genDef(Gen.java:614)
at jdk.compiler/com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2472)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:755)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1680)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1648)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:964)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
at jdk.compiler/com.sun.tools.javac.launcher.Main.compile(Main.java:399)
at jdk.compiler/com.sun.tools.javac.launcher.Main.run(Main.java:202)
at jdk.compiler/com.sun.tools.javac.launcher.Main.main(Main.java:132)
error: compilation failed