-
Bug
-
Resolution: Fixed
-
P4
-
None
-
b03
-
generic
-
generic
The following class throws a verifier error when compiled in JDK 24:
$ cat LambdaOuterCapture.java
public class LambdaOuterCapture {
public class Inner {
public Inner() {
Runnable r = () -> System.out.println(LambdaOuterCapture.this);
this(r);
}
public Inner(Runnable r) {
}
}
public static void main(String[] args) {
new LambdaOuterCapture().new Inner();
}
}
$ javac --enable-preview --release 24 LambdaOuterCapture.java
$ java --enable-preview LambdaOuterCapture
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
LambdaOuterCapture$Inner.<init>(LLambdaOuterCapture;)V @1: invokedynamic
Reason:
Type uninitializedThis (current frame, stack[0]) is not assignable to 'LambdaOuterCapture$Inner'
Current Frame:
bci: @1
flags: { flagThisUninit }
locals: { uninitializedThis, 'LambdaOuterCapture' }
stack: { uninitializedThis }
Bytecode:
0000000: 2aba 0001 0000 4d2a 2b2c b700 05b1
at LambdaOuterCapture.main(LambdaOuterCapture.java:15)
$ cat LambdaOuterCapture.java
public class LambdaOuterCapture {
public class Inner {
public Inner() {
Runnable r = () -> System.out.println(LambdaOuterCapture.this);
this(r);
}
public Inner(Runnable r) {
}
}
public static void main(String[] args) {
new LambdaOuterCapture().new Inner();
}
}
$ javac --enable-preview --release 24 LambdaOuterCapture.java
$ java --enable-preview LambdaOuterCapture
Exception in thread "main" java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
LambdaOuterCapture$Inner.<init>(LLambdaOuterCapture;)V @1: invokedynamic
Reason:
Type uninitializedThis (current frame, stack[0]) is not assignable to 'LambdaOuterCapture$Inner'
Current Frame:
bci: @1
flags: { flagThisUninit }
locals: { uninitializedThis, 'LambdaOuterCapture' }
stack: { uninitializedThis }
Bytecode:
0000000: 2aba 0001 0000 4d2a 2b2c b700 05b1
at LambdaOuterCapture.main(LambdaOuterCapture.java:15)
- relates to
-
JDK-8334679 Wrong bug number in regression test for JDK-8334252
- Resolved