Summary: | [Java 5] Verification error when creating anonymous enum subtypes | ||||||
---|---|---|---|---|---|---|---|
Product: | [Eclipse Project] JDT | Reporter: | Kai-Uwe Maetzel <kai-uwe_maetzel> | ||||
Component: | Core | Assignee: | Philipe Mulet <philippe_mulet> | ||||
Status: | VERIFIED FIXED | QA Contact: | |||||
Severity: | major | ||||||
Priority: | P3 | ||||||
Version: | 3.1 | ||||||
Target Milestone: | 3.1 M4 | ||||||
Hardware: | PC | ||||||
OS: | Windows XP | ||||||
Whiteboard: | |||||||
Attachments: |
|
Description
Kai-Uwe Maetzel
2004-12-15 12:56:03 EST
Created attachment 16656 [details]
source/class files
I will investigate. Indeed this seems to be a bug in the inner emulation for enum types. A synthetic constructor is created with the following contents: // Method descriptor #144 (Ljava/lang/String;ILp/Day;)V // Stack: 1, Locals: 4 synthetic p.Day(String arg, int arg, Day arg); 0 aload_0 1 invokespecial #43 <Method p/Day.<init>(Ljava/lang/String;I)V> 4 return Line numbers: [pc: 0, line: 21] There is a missing int and string on the stack prior to the invokespecial call. Simple test case:` public enum Day { MONDAY { public void foo() { } }; private Day() { } public static void main(String[] args) { } } Error is: Exception in thread "main" java.lang.VerifyError: (class: Day, method: <init> signature: (Ljava/lang/String;ILDay;)V) Expecting to find integer on stack If you remove the private constructor, it works. // Method descriptor #56 (Ljava/lang/String;ILDay;)V // Stack: 1, Locals: 4 synthetic Day(String arg, int arg, Day arg); 0 aload_0 1 invokespecial #57 <Method Day.<init>(Ljava/lang/String;I)V> 4 return Line numbers: [pc: 0, line: 8] Missing argument on stack. Private constructor emulation is not handling enum extra constructor arguments. Added test: EnumTest#test059. Fixed Verified in 200412160010 |