switch expression without value
Jan Lahoda
jan.lahoda at oracle.com
Wed Nov 21 14:48:57 UTC 2018
Hi Anna,
I believe this is the same as
https://bugs.openjdk.java.net/browse/JDK-8212982
(which has just been fixed.)
Jan
On 21.11.2018 14:45, Anna Kozlova wrote:
> 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
More information about the compiler-dev
mailing list