Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354861 - Need to check for invalid enumerations
Summary: Need to check for invalid enumerations
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 354901 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-08-16 12:56 EDT by Matt Heitz CLA
Modified: 2017-02-23 14:19 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Heitz CLA 2011-08-16 12:56:56 EDT
1. This one is invalid because Betty has no value (this is not meant as an insult to anyone named Betty).

enumeration Bad1
	Fred = 1, Bob = 2, Nancy = 3, Betty
end



2. All of these values are bad (none is an int).

enumeration Bad2
	Fred = false, Bob = null, Nancy = 12345678901234567890, Betty = "Ha!"
end



3. An enumeration with no values should be invalid.

enumeration Bad3
end
Comment 1 Matt Heitz CLA 2011-08-16 17:29:38 EDT
On second thought, that first case should be valid.  If a field hasn't been given a value we'll use its position.  So in my example Betty would be 4.
Comment 2 Paul Harmon CLA 2011-10-25 10:56:40 EDT
*** Bug 354901 has been marked as a duplicate of this bug. ***
Comment 3 Paul Harmon CLA 2011-10-26 16:27:34 EDT
I have added lots of validation to Enumerations. I have also added code to default the int constant value for each entry based on it's definition location. The first entry in the enumeration will have a default value of 1.
Comment 4 Matt Heitz CLA 2011-11-01 10:52:01 EDT
The enumeration with no values wasn't marked as invalid.  The other problems are fixed.

enumeration Bad3
end
Comment 5 Paul Harmon CLA 2011-11-07 14:57:59 EST
I have added the check to disallow enumerations with no fields to EnumerationValidator
Comment 6 Matt Heitz CLA 2011-11-16 11:05:42 EST
Verified.