-
Bug
-
Resolution: Fixed
-
P3
-
11.0.20, 17.0.9, 21.0.1, 22, 23
-
b07
-
generic
-
linux
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8325554 | 22.0.1 | Jan Lahoda | P3 | Resolved | Fixed | b04 |
Filing for javac, but might as well a hotspot verifier issue. Not sure.
The issue got originally filed via adoptium here:
https://github.com/adoptium/adoptium-support/issues/991
This snippet:
public class Foo {
public static void main(String[] args) {
}
private void unused() {
boolean b;
String test = ((((b = true) ? null : null) + "") + b);
}
}
Compiles fine, but throws a VerifyError at runtime, unless --release 8 is being used when compiling the code:
$bin/javac --release 8 Foo.java
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
$ bin/java Foo
<nothing>
Don't specify '--release 8' and we see the VerifyError:
$ bin/javac Foo.java
$ bin/java Foo
Error: Unable to initialize main class Foo
Caused by: java.lang.VerifyError: Bad local variable type
Exception Details:
Location:
Foo.unused()Ljava/lang/String; @0: iload_1
Reason:
Type top (current frame, locals[1]) is not assignable to integer
Current Frame:
bci: @0
flags: { }
locals: { 'Foo' }
stack: { }
Bytecode:
0000000: 1bba 0007 0000 4d2c b0
Expected (runtime) behaviour:
Works the same as when compiled with '--release 8', i.e. no VerifyError.
The issue got originally filed via adoptium here:
https://github.com/adoptium/adoptium-support/issues/991
This snippet:
public class Foo {
public static void main(String[] args) {
}
private void unused() {
boolean b;
String test = ((((b = true) ? null : null) + "") + b);
}
}
Compiles fine, but throws a VerifyError at runtime, unless --release 8 is being used when compiling the code:
$bin/javac --release 8 Foo.java
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
3 warnings
$ bin/java Foo
<nothing>
Don't specify '--release 8' and we see the VerifyError:
$ bin/javac Foo.java
$ bin/java Foo
Error: Unable to initialize main class Foo
Caused by: java.lang.VerifyError: Bad local variable type
Exception Details:
Location:
Foo.unused()Ljava/lang/String; @0: iload_1
Reason:
Type top (current frame, locals[1]) is not assignable to integer
Current Frame:
bci: @0
flags: { }
locals: { 'Foo' }
stack: { }
Bytecode:
0000000: 1bba 0007 0000 4d2c b0
Expected (runtime) behaviour:
Works the same as when compiled with '--release 8', i.e. no VerifyError.
- backported by
-
JDK-8325554 Compilation of snippet results in VerifyError at runtime with --release 9 (and above)
- Resolved