Bug 83648 - [1.5] Enum constructor cannot be public or protected
Summary: [1.5] Enum constructor cannot be public or protected
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-25 14:45 EST by Markus Keller CLA
Modified: 2005-02-16 13:01 EST (History)
0 users

See Also:


Attachments
Apply on HEAD (4.53 KB, patch)
2005-01-25 16:08 EST, Olivier Thomann CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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