Bug 78914 - [1.5][compiler] super() cannot be called in the constructor of an enum declaration
Summary: [1.5][compiler] super() cannot be called in the constructor of an enum declar...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M4   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-17 23:30 EST by Olivier Thomann CLA
Modified: 2004-12-14 15:58 EST (History)
0 users

See Also:


Attachments
Apply on HEAD (3.87 KB, patch)
2004-11-29 17:14 EST, Olivier Thomann CLA
no flags Details | Diff
Apply on HEAD (3.87 KB, patch)
2004-11-29 17:17 EST, Olivier Thomann CLA
no flags Details | Diff
Apply on HEAD (3.45 KB, patch)
2004-11-29 17:30 EST, Olivier Thomann CLA
no flags Details | Diff
Test case (1.00 KB, patch)
2004-11-29 17:38 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 Olivier Thomann CLA 2004-11-17 23:30:32 EST
Using latest, the compiler doesn't complain when super(); is used in an enum
constructor.
Test case:
public enum X {
	;
	X() {
		super();
	}
}

javac reports:
X.java:4: call to super not allowed in enum constructor
                super();
                ^
1 error
Comment 1 Olivier Thomann CLA 2004-11-29 14:34:06 EST
I think I know how to fix this one.
I'll provide a patch.
Comment 2 Olivier Thomann CLA 2004-11-29 17:14:24 EST
Created attachment 16214 [details]
Apply on HEAD
Comment 3 Olivier Thomann CLA 2004-11-29 17:14:45 EST
Philippe, could you please verify it?
Comment 4 Olivier Thomann CLA 2004-11-29 17:17:10 EST
Created attachment 16215 [details]
Apply on HEAD

Modify the error message to:
Explicit constructor call is not allowed in an enum constructor

instead of:
Explicit constructor call is not allowed in enum constructor
Comment 5 Olivier Thomann CLA 2004-11-29 17:30:47 EST
Created attachment 16222 [details]
Apply on HEAD

I forgot to test if the explicit constructor call was an implicit super. It is
ok, if this is an implicit super.
Comment 6 Olivier Thomann CLA 2004-11-29 17:31:04 EST
All ASTConverter15Test passed with this last patch.
Comment 7 Olivier Thomann CLA 2004-11-29 17:38:16 EST
Created attachment 16223 [details]
Test case

Apply on org.eclipse.jdt.core.tests.compiler
Comment 8 Philipe Mulet CLA 2004-11-30 09:26:01 EST
Integrated proposed patch (and renamed a few things).
Added extra regression test: EnumTest#test051.
Fixed
Comment 9 Olivier Thomann CLA 2004-12-14 15:58:02 EST
Verified in 200412140800