Bug 340029

Summary: [1.5][compiler] Enum constructor that throws Exception reports a confusing error message
Product: [Eclipse Project] JDT Reporter: Olivier Thomann <Olivier_Thomann>
Component: CoreAssignee: Olivier Thomann <Olivier_Thomann>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: satyam.kandula
Version: 3.7   
Target Milestone: 3.7 M7   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Proposed fix + regression test none

Description Olivier Thomann CLA 2011-03-15 10:26:02 EDT
Compiling the following code:
public enum X {
  A, B;
  private X() throws Exception {
  }
}
It reports:
----------
1. ERROR in C:\tests_sources\X.java (at line 1)
	public enum X {
	^
Unhandled exception type Exception
----------
2. ERROR in C:\tests_sources\X.java (at line 1)
	public enum X {
	^
Unhandled exception type Exception
----------
2 problems (2 errors)

It is confusing to find out what the problem is.
The error should be reported against the enum constant.
Comment 1 Olivier Thomann CLA 2011-03-15 13:27:08 EDT
Created attachment 191229 [details]
Proposed fix + regression test
Comment 2 Olivier Thomann CLA 2011-03-15 13:27:21 EDT
Released for 3.7M7.
Comment 3 Satyam Kandula CLA 2011-04-25 11:04:37 EDT
I think the error message could be further improved by giving the error at X rather than A and B. I have filed bug 343738 to take care of it. 
As the error message has improved, I am marking this as Verified. 
Verified for 3.7M7 using I20110421-1800