Community
Participate
Working Groups
The class below compiles fine, but at runtime it can't be executed and JVM throws VerifyError. Error: Unable to initialize main class verifyerror.X Caused by: java.lang.VerifyError: Bad type on operand stack Exception Details: Location: verifyerror/X.crashNow()V @36: invokevirtual Reason: Type 'java/lang/Object' (current frame, stack[1]) is not assignable to 'verifyerror/Z' Current Frame: bci: @36 flags: { } locals: { 'java/util/Map$Entry', 'java/util/Iterator' } stack: { '[I', 'java/lang/Object' } Bytecode: 0000000: b200 13b9 0021 0100 b900 2701 004c a700 0000010: 1b2b b900 2d01 00c0 0033 4bb8 0035 2ab9 0000020: 0038 0100 b600 3b2e 572b b900 4101 009a 0000030: ffe2 b200 4512 4bb6 004d b1 Stackmap Table: full_frame(@17,{Top,Object[#46]},{}) same_frame(@41) Changing the code to use temporary local variable fixes the issue. ########## package verifyerror; import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; public class X { private static final Map<Z, Object> map = new HashMap<>(); public static void main(String[] args) { crashNow(); } static void crashNow() { for (Entry<Z, Object> entry : map.entrySet()) { switch (entry.getKey()) { case A: continue; default: break; } } System.out.println("No crash if you see this"); } } enum Z { A, B } ########## "Fix": Z key = entry.getKey(); switch (key) { This is a regression in 4.22.
I've bisected this crash to commit 258240a7cae9336cb26bd41d3da9533bc39eab64 So it is a regression from bug 575047. Gerrit: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/184014 Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=258240a7cae9336cb26bd41d3da9533bc39eab64 Jay: could you please check?
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/185652
(In reply to Eclipse Genie from comment #2) > New Gerrit change created: > https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/185652 Only the regression test. I would be happy if someone could point to the right fix.
(In reply to Andrey Loskutov from comment #1) > Jay: could you please check? This is due to a disappointingly bad refactoring that resulted in removal of a useful line of code. Will take this through.
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/185688
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/185688 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=805fb5849ab3de166270aa38361f3017f07e54cb
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/185652 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=72c206c046e77c4139d6101eee427aa67cf19ddd
Thanks Andrey for the test and narrowing down to the cause.
*** Bug 576008 has been marked as a duplicate of this bug. ***
Verified with I20210922-1800 Thanks Jay!
*** Bug 576404 has been marked as a duplicate of this bug. ***
How can I download a copy of eclipse with this fix? I downloaded the 2021-09, package and it still contains this bug.
(In reply to Lucas Vander Wal from comment #12) > How can I download a copy of eclipse with this fix? I downloaded the > 2021-09, package and it still contains this bug. I was able to download the 2021-12 developer version, and it is fixed in that version.
*** Bug 576534 has been marked as a duplicate of this bug. ***
Is there a workaround for version 2021-09? Will it be updated?
(In reply to Daniel Barciela from comment #16) > Is there a workaround for version 2021-09? Will it be updated? I assume you installed the Java 17 patch on top of 2021-09? If so, we can perhaps update the patch.
Facing "VerifyError: Bad type on operand stack" with up-to-date eclipse-jee-2021-09-R. Will there be a patch for 2021-09-R ?
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/186174
Just to add that, based on our experience and on this post on StackOverflow: https://stackoverflow.com/questions/69197046/jdk-17-switch-statement-causes-java-lang-verifyerror-bad-type-on-operand-stack this problem also happens with switches on Strings, not just on Enums. We solved by uninstalling the JDT patch for Java 17 from our Eclipse 2021-09 installation.
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/186174 was merged to [BETA_JAVA17]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=00529f6ffb3d3c5fa77054fa4cb5e158c01fd0d9
(In reply to Lionel Duriez from comment #18) > Facing "VerifyError: Bad type on operand stack" with up-to-date > eclipse-jee-2021-09-R. > > Will there be a patch for 2021-09-R ? (In reply to Mauro Molinari from comment #20) > Just to add that, based on our experience and on this post on StackOverflow: > > https://stackoverflow.com/questions/69197046/jdk-17-switch-statement-causes-java-lang-verifyerror-bad-type-on-operand-stack > > > this problem also happens with switches on Strings, not just on Enums. > > We solved by uninstalling the JDT patch for Java 17 from our Eclipse 2021-09 > installation. A new patch has been released with this fix. Please try out the same from marketplace or the update site.
I can confirm this does also fix my filed bug 576008. I have also updated the stackoverflow question with an answer. (In reply to Jay Arthanareeswaran from comment #22) > (In reply to Lionel Duriez from comment #18) > > Facing "VerifyError: Bad type on operand stack" with up-to-date > > eclipse-jee-2021-09-R. > > > > Will there be a patch for 2021-09-R ? > > > (In reply to Mauro Molinari from comment #20) > > Just to add that, based on our experience and on this post on StackOverflow: > > > > https://stackoverflow.com/questions/69197046/jdk-17-switch-statement-causes-java-lang-verifyerror-bad-type-on-operand-stack > > > > > > this problem also happens with switches on Strings, not just on Enums. > > > > We solved by uninstalling the JDT patch for Java 17 from our Eclipse 2021-09 > > installation. > > A new patch has been released with this fix. Please try out the same from > marketplace or the update site.
Just updated eclipse-jee-2021-09-R (Help > Check for Updates), proposed update is: Eclipse JDT (Java Development Tools) Patch with Java 17 support for 2021-09 development stream 1.2.200.v20210914-1442_BETA_JAVA17 Bug is not fixed in the above Eclipse JDT Patch. Do we need to change Eclipse configuration in order to find the fix ?
I'm hitting this bug through code compiled with AJC from ascpectj 1.9.8.RC1
(In reply to Lionel Duriez from comment #24) > Just updated eclipse-jee-2021-09-R (Help > Check for Updates), proposed > update is: > Eclipse JDT (Java Development Tools) Patch with Java 17 support for 2021-09 > development stream 1.2.200.v20210914-1442_BETA_JAVA17 > > Bug is not fixed in the above Eclipse JDT Patch. > > Do we need to change Eclipse configuration in order to find the fix ? I don't know why the check for updates is bringing the older version. You can update via the "Install new Software" option and using one of the following update sites: https://download.eclipse.org/eclipse/updates/4.21-P-builds/ (or) https://download.eclipse.org/eclipse/updates/4.21-P-builds/P20211026-0140/