You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This code should not compile at 23, without preview enabled. It does.
When run it reports:
Exception in thread "main" java.lang.BootstrapMethodError: bootstrap method initialization exception
at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:188)
at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:316)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:274)
at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:264)
at X.main(X.java:4)
Caused by: java.lang.IllegalArgumentException: label with illegal type found: class java.lang.Boolean
at java.base/java.lang.runtime.SwitchBootstraps.verifyLabel(SwitchBootstraps.java:172)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at java.base/java.lang.runtime.SwitchBootstraps.typeSwitch(SwitchBootstraps.java:156)
at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:147)
... 4 more
public class X {
public static void main(String[] args) {
Boolean b = null;
switch (b) {
case true -> System.out.println("true");
case false -> System.out.println("false");
case null -> System.out.println("Null");
}
}
}
The text was updated successfully, but these errors were encountered:
Master:
There are at least two problems here:
The text was updated successfully, but these errors were encountered: