Bug 83648

Summary: [1.5] Enum constructor cannot be public or protected
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: minor    
Priority: P3    
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Apply on HEAD none

Description Markus Keller CLA 2005-01-25 14:45:10 EST
I20050118-1015

public enum Enu {
    A(1, 3), B(1, 3), C(1, 3) { }
   	;
    public Enu(int i, int j) { }
}

According to javac and JLS3 8.8.3, enum constructors are implicitly private and
cannot be declared public or protected.
Comment 1 Olivier Thomann CLA 2005-01-25 16:08:03 EST
Created attachment 17436 [details]
Apply on HEAD

Possible patch that would report:
----------
1. ERROR in c:\tests_sources\X.java
 (at line 4)
	public	X(int i, int j) { }
		^^^^^^^^^^^^^^^
Illegal modifier for the enum constructor; only private is permitted.
----------
1 problem
Comment 2 Philipe Mulet CLA 2005-02-07 11:37:40 EST
Patch looks good.
Comment 3 Olivier Thomann CLA 2005-02-07 21:13:19 EST
Fixed and released in HEAD.
Regression tests added in EnumTest.test068, 069 and 070.
Comment 4 David Audel CLA 2005-02-16 13:01:43 EST
Verified in I20050215-2300