Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 368996 - [compiler] VerifyError: Inconsistent stackmap frames at branch target x in method y at offset z.
Summary: [compiler] VerifyError: Inconsistent stackmap frames at branch target x in me...
Status: VERIFIED DUPLICATE of bug 359495
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.7.2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-18 13:33 EST by Carsten Otto CLA
Modified: 2012-03-13 06:34 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Otto CLA 2012-01-18 13:33:25 EST
Build Identifier: Version: Indigo Service Release 1 Build id: 20110916-0149

The code compiled for the following method cannot be verified.

Based on the created .class file the finally-block is reached with at least two paths:
a) a local variable filled with "x"
b) no local variable for "x"

This seems to be the problem for the bytecode verifier.

Oracle's compiler creates two versions of the finally block.

private static boolean foo() {
    try {
        for (final Object x : new LinkedHashSet<>()) {
            if (x instanceof Object) {
                return false;
            }
        }
        return false;
    } finally {
       foo();
    }
}

Reproducible: Always

Steps to Reproduce:
1. Create a class containing the above code
2. Call the method from some (other?) class
3. At runtime see the VerifyError as soon as the invocation is executed
Comment 1 Ayushman Jain CLA 2012-01-19 00:12:30 EST
This seems to have been fixed. I'm trying to find the bug which fixed this.
Comment 2 Srikanth Sankaran CLA 2012-01-19 00:45:09 EST
Full test case:

// ---
import java.util.LinkedHashSet;

public class X {
	private static boolean foo() {
	    try {
	        for (final Object x : new LinkedHashSet<>()) {
	            if (x instanceof Object) {
	                return false;
	            }
	        }
	        return false;
	    } finally {
	       foo();
	    }
	}
	
	public static void main(String [] args) {
		System.out.println("Done");
	}
}

//---

This fails to verify on 3.7.1, but run alright with
3.7.2 RC2 Build id: M20120118-0800.

Several verify errors have been fixed in the interim, I'll
see if I dig up the duplicate.
Comment 3 Ayushman Jain CLA 2012-01-19 01:46:08 EST
Confirmed that fix for 359495 also fixes this

*** This bug has been marked as a duplicate of bug 359495 ***
Comment 4 Ayushman Jain CLA 2012-01-19 01:52:08 EST
Verified for 3.7.2RC2 using build M20120118-0800
Comment 5 Jay Arthanareeswaran CLA 2012-03-12 02:04:21 EDT
This seem to have been missed out in our M5 verification. Marking it for M6.
Comment 6 Stephan Herrmann CLA 2012-03-13 06:34:41 EDT
Verified for 3.8 M6 using build I20120312-0800.