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

Bug 335942

Summary: Validation of Default Value literals
Product: [Modeling] EMF Reporter: Markus Surudo <ms>
Component: CoreAssignee: Ed Merks <Ed.Merks>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: awhelan, jos.warmer, lothar, stepper
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Markus Surudo CLA 2011-02-01 04:55:06 EST
Build Identifier: 

Eike Stepper started a newsgroup thread about this topic on 10/17/2010 and forgot to submit a bugzilla.

For EENums we could assume, that 99.9% of the time no one would specialize the code of the generated factory.

Reproducible: Always
Comment 1 Ed Merks CLA 2011-02-01 08:45:04 EST
Want to include a link to that thread?

We could assume that and be wrong only .1% of the time as opposed to assuming nothing but overlooking potential/likely problems that aren't discovered until later. It's a trade-off...
Comment 3 Lothar Werzinger CLA 2012-12-11 02:19:54 EST
This bug caused a very mysterious NPE in CDO and we spent a lot of time trying to find the cause.
Only after hiring Eike the CDO master we were pointed to this discrepancy in our model. We were quite surprised that this mismatch was not detected by the ECore validator of model generator.

We would appreciate if this could be fixed to spare future users the painful search for mystery bugs.
Comment 4 Andrew Whelan CLA 2012-12-12 10:00:31 EST
Hello,

I recently had to spend a lot of time because of this issue myself. In my case Eike Stepper was kind enough to send me looking in the right direction. He believes that this was the issue I was running into.

I had an EAttribute that was using an EENum which had no default literal value. The following Eclipse forum thread link will explain what went on.

http://www.eclipse.org/forums/index.php/t/441349/

I'm just hoping this can be fixed so future users won't be plagued with this.

Thanks Eike!
Comment 5 Ed Merks CLA 2012-12-18 13:14:42 EST
I've changed the logic for special case handling of literals for enums (as well as for types with conversion delegates).

http://git.eclipse.org/c/emf/org.eclipse.emf.git/commit/?id=09bf73b41dbfdfc9978834a6943ea2f314a11879
Comment 6 Eike Stepper CLA 2012-12-18 15:05:27 EST
You're the greatest ;-)
Comment 7 Ed Merks CLA 2013-07-10 11:27:22 EDT
The changes are available in Kepler.