switch expression without value
Anna Kozlova
anna.kozlova at jetbrains.com
Wed Nov 21 13:45:26 UTC 2018
Hi all,
looks like the code should not compile
public class MyTest {
public static void main(String[] args) {
Supplier<String> stringSupplier = switch (args.length) {
default -> {
}
};
}
}
At least running the class I get verify error:
Exception in thread "main" java.lang.VerifyError: Bad local variable type
Exception Details:
Location:
org/jetbrains/MyTest.main([Ljava/lang/String;)V @12: aload_2
Reason:
Type top (current frame, locals[2]) is not assignable to reference type
Current Frame:
bci: @12
flags: { }
locals: { '[Ljava/lang/String;' }
stack: { }
Bytecode:
0000000: 2abe ab00 0000 000a 0000 0000 2c4c b1
Stackmap Table:
same_frame(@12)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:325)
at
com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:107)
Thanks,
Anna
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20181121/05e7c7d2/attachment.html>
More information about the compiler-dev
mailing list