Bug 340029 - [1.5][compiler] Enum constructor that throws Exception reports a confusing error message
Summary: [1.5][compiler] Enum constructor that throws Exception reports a confusing er...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7 M7   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-15 10:26 EDT by Olivier Thomann CLA
Modified: 2011-04-25 11:04 EDT (History)
1 user (show)

See Also:


Attachments
Proposed fix + regression test (4.63 KB, patch)
2011-03-15 13:27 EDT, 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 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