Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 394718

Summary: VerifyError: Inconsistent stackmap frames
Product: [Eclipse Project] JDT Reporter: Daniel Mould <skyewire>
Component: CoreAssignee: Jay Arthanareeswaran <jarthana>
Status: VERIFIED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: jarthana, manoj.palat, Olivier_Thomann, srikanth_sankaran, stephan.herrmann
Version: 3.8.1   
Target Milestone: 3.8.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Sample program to reproduce VerifyError
none
Proposed fix
none
Regression test none

Description Daniel Mould CLA 2012-11-20 18:43:25 EST
Created attachment 223777 [details]
Sample program to reproduce VerifyError

If the attached program is compiled with Eclipse, running it results in the following error:

Exception in thread "main" java.lang.VerifyError: Inconsistent stackmap frames at branch target 46 in method VerifyErrorTest.test()Ljava/lang/Boolean; at offset 2

I originally encountered the problem in some fairly complicated production code, and managed to narrow the problem down to the simple test case that is attached. Additional information:

- The program runs fine if compiled with Oracle's javac.
- The program runs fine if the return type of the method is changed from "Boolean" to "boolean".

Environment:

OS: Windows 7 64-bit
Java: Oracle Java 1.7.0_09 32-bit
Eclipse version: Juno SR1
JDT version: 3.8.1.v20120814-104540-8-8nFqpFNOfwKDRVz-tXOcL5d_83
Comment 1 Olivier Thomann CLA 2012-11-20 20:37:46 EST
The problem seems to come from the fact that the return false; statements shares the subroutines when there is an additional variable used to store the boxing value.
I believe in this case, we don't want to share the subroutines. Doing so fixes this issue.
Srikanth, there might be a clever way to do it, but I don't think this is worth the effort.
Comment 2 Olivier Thomann CLA 2012-11-20 20:44:16 EST
Created attachment 223779 [details]
Proposed fix
Comment 3 Olivier Thomann CLA 2012-11-20 20:44:29 EST
Created attachment 223780 [details]
Regression test
Comment 4 Olivier Thomann CLA 2012-11-20 20:45:02 EST
Srikanth, if you approve the fix, I think it is a good candidate for backporting.
Comment 5 Srikanth Sankaran CLA 2012-11-21 01:41:12 EST
The fix looks non-controversial to me. Jay, please take it forward please,TIA.
Comment 6 Olivier Thomann CLA 2012-11-21 07:41:51 EST
Daniel, thanks for the test case. It was very helpful to fix it. Once this is realeased, could you please give it a try on your more complex code?
Comment 7 Daniel Mould CLA 2012-11-21 14:55:52 EST
(In reply to comment #6)
> Daniel, thanks for the test case. It was very helpful to fix it. Once this
> is realeased, could you please give it a try on your more complex code?

Hi Olivier, sure, will do.
Comment 8 Jay Arthanareeswaran CLA 2012-11-22 11:20:45 EST
All tests pass. Released in master and R3_8_maintenance.

Thanks for the patch, Olivier!
Comment 9 Stephan Herrmann CLA 2012-12-11 05:05:41 EST
Verified for 4.3 M4 using build I20121210-2000.

Leaving bug status at resolved for verification against 3.8.2.
Comment 10 Manoj N Palat CLA 2013-01-10 04:44:26 EST
Verified for 4.2.2 M20130109-1200