Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 354861

Summary: Need to check for invalid enumerations
Product: z_Archived Reporter: Matt Heitz <mheitz>
Component: EDTAssignee: Project Inbox <edt.compiler-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: margolis, pharmon, svihovec
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

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.