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

Bug 324863

Summary: Invalid Validator.validate methods generated by 2.6 if runtime version = 2.4
Product: [Modeling] EMF Reporter: Henning Heitkoetter <hheitkoetter>
Component: ToolsAssignee: Dave Steinberg <davidms>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: Ed.Merks, Kenn.Hussey
Version: 2.6.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Henning Heitkoetter CLA 2010-09-09 11:57:06 EDT
A genmodel with runtime version set to 2.4 can generate a broken validator class in EMF 2.6: a validate method references the method validate_EveryBidirectionalReferenceIsPaired, which is available only since 2.6 (?).

This happens because of the structure of the following if-statement in GenClassImpl.getIntrinsicConstraints:
	if (runtimeVersion <= GenRuntimeVersion.EMF22_VALUE)
    {
      result.remove("EveryKeyUnique");
      result.remove("EveryMapEntryUnique");
    }
	else if (runtimeVersion < GenRuntimeVersion.EMF25_VALUE)
	{
      result.remove("NoCircularContainment");
	}
	else if (runtimeVersion < GenRuntimeVersion.EMF26_VALUE)
	{
      result.remove("EveryBidirectionalReferenceIsPaired");
	}
	
To me it seems - without knowing the history - that both "else" are wrong and should be removed, so that there are three distinct if statements (emulating a switch with fall-through).
Comment 1 Ed Merks CLA 2010-09-09 12:15:57 EDT

*** This bug has been marked as a duplicate of bug 324207 ***