Bug 38702

Summary: Compiler generates illegal bytecode in switch statement. VerifyError.
Product: [Eclipse Project] JDT Reporter: Eckart Langhuth <eckart.langhuth>
Component: CoreAssignee: JDT-Core-Inbox <jdt-core-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: major    
Priority: P3 CC: christian.brand
Version: 2.1   
Target Milestone: 3.0 M2   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Eckart Langhuth CLA 2003-06-10 09:30:20 EDT
Using Version: 2.1.0 Build id: 200303202147

Compiling and running the Main class listed below results in the error:
java.lang.VerifyError: (class: test/Main, method: ResultType signature: ()V) 
Illegal target of jump or branch
Exception in thread "main"

This seems to be a new problem.
(The code comes from some generated code which worked properly in older 
versions. I just tested Eclipse 2.1 M3 build and it's ok)

I tried to find the essence of the problem in the switch block. Even small 
changes solve the problem.
(For example: removing case 2:break; block or replace default : throw 
newException(); with default : System.out.println();)

package test;
public class Main {
  private int i = 0;
  public static void main(String[] args) {
    System.out.println("Hello");
  }
  final public void ResultType() throws Exception {
    switch (i) {
      case 1 :
        if (true)
          throw new Exception();
        break;
      case 2 :
        break;
      default :
        throw new Exception();
    }
  }
}
Comment 1 Philipe Mulet CLA 2003-06-10 09:32:44 EDT

*** This bug has been marked as a duplicate of 37621 ***