Bug 154162 - [1.5][compiler] Uninformative error message for qualified enum constants in switch statement
Summary: [1.5][compiler] Uninformative error message for qualified enum constants in s...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.3   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.5 M4   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-16 17:10 EDT by Max Gilead CLA
Modified: 2008-12-08 22:03 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Max Gilead CLA 2006-08-16 17:10:47 EDT
When Eclipse encounters a switch statement with qualified enum constants the error message displayed is uninformative:

'The enum constant A.CONST1 reference cannot be qualified in a case label'

It says what is wrong but doesn't suggest a solution. Javac gives much better error message:

'An enum switch case label must be the unqualified name of an enumeration constant'

This message clearly suggests what user should do to fix the problem.

It took me several minutes of googling to find out what's the solution and I finally got it after trying test case and reading patch for Eclipse bug #77151 :)

Eclipse 3.3M1
Comment 1 Kent Johnson CLA 2008-11-18 16:45:20 EST
How about?

"The qualified case label X.Y.Z must be replaced with the simple enum constant name Z"
Comment 2 Philipe Mulet CLA 2008-11-18 18:05:42 EST
'The reference to enum constant CONST1 should not be qualified in a case label'
?
Comment 3 Max Gilead CLA 2008-11-18 18:39:25 EST
Maybe "The qualified case label X.Y.Z must be replaced with the unqualified enum constant name Z"?
Comment 4 Kent Johnson CLA 2008-11-19 11:39:57 EST
I'm going to use :

"The qualified case label X.Y.Z must be replaced with the unqualified enum constant Z"

since its similar to these other enum messages :

759 = The field {0}.{1} cannot be referenced from an enum case label; only enum constants can be used in enum switch
761 = The enum constant {0}.{1} has no corresponding case label

And I'm going to remove the qualification from the last optional message :

761 = The enum constant {0} needs a corresponding case label in this enum switch
Comment 5 Kent Johnson CLA 2008-11-20 11:28:56 EST
Changed these 2 enum messages :

755 = The qualified case label {0}.{1} must be replaced with the unqualified enum constant {1}

761 = The enum constant {1} needs a corresponding case label in this enum switch on {0}
Comment 6 Kent Johnson CLA 2008-11-20 11:30:18 EST
Fix released for 3.5M4
Comment 7 Olivier Thomann CLA 2008-12-08 22:03:24 EST
Verified for 3.5M4 using I20081208-1800.

I would however expect the whole qualified constant to be underlined.