Summary: | [1.5] java.lang.VerifyError with Enums | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Matthew Hall <qualidafial> | ||||
Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | critical | ||||||
Priority: | P3 | ||||||
Version: | 3.1 | ||||||
Target Milestone: | 3.1 M5 | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Matthew Hall
2005-01-27 14:23:10 EST
I will investigate. Reproduced. Exception in thread "main" java.lang.VerifyError: (class: X, method: <init> signature: (Ljava/lang/String;IILX;)V) Register 1 contains wrong type Test case is: enum X { ITEM (0) {}; // curly braces make ITEM an anonymous subclass private X(int i) {} public static void main(String[] args) { for (X x : values()) { System.out.println(x); } } } The line: 3 iload_1 is boggus. It should be: 3 iload_3 // Method descriptor #73 (Ljava/lang/String;IILX;)V // Stack: 4, Locals: 5 synthetic X(String arg, int arg, int arg, X arg); 0 aload_0 [local_0] 1 aload_1 [local_1] 2 iload_2 [local_2] 3 iload_1 [local_1] 4 invokespecial X.<init>(Ljava/lang/String;II)V [74] 7 return Line numbers: [pc: 0, line: 4] Created attachment 17526 [details]
Apply on CodeStream
Patch looks good. I would write it though: if (declaringClass.erasure().id == T_JavaLangEnum || declaringClass.isEnum()) { this.aload_1(); // pass along name param as name arg this.iload_2(); // pass along ordinal param as ordinal arg resolvedPosition += 2; } Fixed and released in HEAD. Regression test added in EnumTest.test066. Verified in I20050215-2300 |