Bug 78916

Summary: [1.5][compiler] abstract methods in an enum declaration must be implemented for each constant
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Philipe Mulet <philippe_mulet>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: jp.fielding
Version: 3.1   
Target Milestone: 3.1 M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Olivier Thomann CLA 2004-11-17 23:47:20 EST
The following code should report an error:

public enum X {
	A
	;
	
	public abstract void foo();
}
Comment 1 Olivier Thomann CLA 2004-11-17 23:49:04 EST
We report an error, but not the right error.
We report:

----------
1. ERROR in C:\tests_sources\X.java (at line 5)
	public abstract void foo();
	                     ^^^^^
The abstract method foo in type X can only be defined by an abstract class
----------
1 problem (1 error)

Javac reports:
X.java:1: X is not abstract and does not override abstract method foo() in X
public enum X {
       ^
1 error
Comment 2 Philipe Mulet CLA 2004-11-30 10:27:45 EST
Indeed, the following should be accepted:
public enum X {
	A () { public void foo() {} }
	;
	
	public abstract void foo();
}
Comment 3 Philipe Mulet CLA 2004-11-30 16:27:38 EST
Support added. Also tagged enum classfile as abstract when defining abstract
methods (implicit).

Added regression tests: EnumTest#test052-055.
Fixed
Comment 4 Philipe Mulet CLA 2004-12-09 18:26:03 EST
*** Bug 77211 has been marked as a duplicate of this bug. ***
Comment 5 Olivier Thomann CLA 2004-12-14 15:59:14 EST
Verified in 200412140800