-
Bug
-
Resolution: Cannot Reproduce
-
P4
-
None
-
21
-
generic
-
generic
ADDITIONAL SYSTEM INFORMATION :
javac --enable-preview -source 20
both be reproducible
java version "20.0.1" 2023-04-18
openjdk version "21-ea" 2023-09-19
I use VSCode and Extension Pack for Java to compile or run.
A DESCRIPTION OF THE PROBLEM :
I could not determine what happens at all, but seems to be reproducible on general environment.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run following class.
The class is successfully compiled but cannot be run.
ACTUAL -
different by yield new Object(); or yield null;
By yield new Object();
java.lang.VerifyError: Operand stack underflow
Exception Details:
Location:
com/example/RecordPreview.test()V @66: astore
Reason:
Attempt to pop empty stack.
Current Frame:
bci: @66
flags: { }
locals: { 'com/example/RecordPreview', top, null, integer }
stack: { }
Bytecode:
0000000: 0159 b800 1357 4d03 3e2c 1dba 0019 0000
0000010: aa00 0000 0000 0079 0000 0000 0000 0001
0000020: 0000 0018 0000 002a a700 0804 3ea7 ffdc
0000030: bb00 0359 b700 08a7 0053 a700 0805 3ea7
0000040: ffca 3a09 0159 b800 1357 3a06 0336 0719
0000050: 0615 07ba 001d 0000 aa00 0000 0000 0027
0000060: 0000 0000 0000 0000 0000 0014 a700 0904
0000070: 3607 a7ff dd01 3a0a 1909 190a a700 0e01
0000080: 3a0a 1909 190a a700 0401 4cb1
Stackmap Table:
full_frame(@9,{Object[#1],Top,Null,Integer},{})
same_frame(@40)
same_frame(@43)
same_frame(@48)
same_frame(@58)
same_frame(@61)
same_frame(@66)
full_frame(@79,{Object[#1],Top,Null,Integer,Top,Top,Null,Integer,Top,Object[#3]},{})
same_frame(@108)
same_frame(@111)
same_frame(@117)
same_frame(@127)
full_frame(@137,{Object[#1],Top,Null,Integer},{})
full_frame(@138,{Object[#1]},{Object[#3]})
By yield null;
java.lang.ClassFormatError: Field " yieldValue0" in class com/example/RecordPreview has illegal signature "N"
---------- BEGIN SOURCE ----------
package com.example;
public class RecordPreview {
public static void main(String[] args) {
}
private void test() {
Object o = switch (null) {
case SealedA() -> {
yield new Object();
// yield null;
}
case SealedB() -> {
yield switch (null) {
case SealedC() -> {
try {
} catch (Exception e) {
}
yield null;
}
default -> null;
};
}
default -> null;
};
}
public sealed interface SealedRecord {
}
public static record SealedA() implements SealedRecord {
}
public static record SealedB() implements SealedRecord {
}
public sealed interface SealedRecord1 {
}
public static record SealedC() implements SealedRecord1 {
}
}
---------- END SOURCE ----------
FREQUENCY : always
javac --enable-preview -source 20
both be reproducible
java version "20.0.1" 2023-04-18
openjdk version "21-ea" 2023-09-19
I use VSCode and Extension Pack for Java to compile or run.
A DESCRIPTION OF THE PROBLEM :
I could not determine what happens at all, but seems to be reproducible on general environment.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile and run following class.
The class is successfully compiled but cannot be run.
ACTUAL -
different by yield new Object(); or yield null;
By yield new Object();
java.lang.VerifyError: Operand stack underflow
Exception Details:
Location:
com/example/RecordPreview.test()V @66: astore
Reason:
Attempt to pop empty stack.
Current Frame:
bci: @66
flags: { }
locals: { 'com/example/RecordPreview', top, null, integer }
stack: { }
Bytecode:
0000000: 0159 b800 1357 4d03 3e2c 1dba 0019 0000
0000010: aa00 0000 0000 0079 0000 0000 0000 0001
0000020: 0000 0018 0000 002a a700 0804 3ea7 ffdc
0000030: bb00 0359 b700 08a7 0053 a700 0805 3ea7
0000040: ffca 3a09 0159 b800 1357 3a06 0336 0719
0000050: 0615 07ba 001d 0000 aa00 0000 0000 0027
0000060: 0000 0000 0000 0000 0000 0014 a700 0904
0000070: 3607 a7ff dd01 3a0a 1909 190a a700 0e01
0000080: 3a0a 1909 190a a700 0401 4cb1
Stackmap Table:
full_frame(@9,{Object[#1],Top,Null,Integer},{})
same_frame(@40)
same_frame(@43)
same_frame(@48)
same_frame(@58)
same_frame(@61)
same_frame(@66)
full_frame(@79,{Object[#1],Top,Null,Integer,Top,Top,Null,Integer,Top,Object[#3]},{})
same_frame(@108)
same_frame(@111)
same_frame(@117)
same_frame(@127)
full_frame(@137,{Object[#1],Top,Null,Integer},{})
full_frame(@138,{Object[#1]},{Object[#3]})
By yield null;
java.lang.ClassFormatError: Field " yieldValue0" in class com/example/RecordPreview has illegal signature "N"
---------- BEGIN SOURCE ----------
package com.example;
public class RecordPreview {
public static void main(String[] args) {
}
private void test() {
Object o = switch (null) {
case SealedA() -> {
yield new Object();
// yield null;
}
case SealedB() -> {
yield switch (null) {
case SealedC() -> {
try {
} catch (Exception e) {
}
yield null;
}
default -> null;
};
}
default -> null;
};
}
public sealed interface SealedRecord {
}
public static record SealedA() implements SealedRecord {
}
public static record SealedB() implements SealedRecord {
}
public sealed interface SealedRecord1 {
}
public static record SealedC() implements SealedRecord1 {
}
}
---------- END SOURCE ----------
FREQUENCY : always