[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.modeling.mdt.uml2.ocl] Problem with validating inherited attribute
|
Hi Newsgroup,
I'm not sure whether this is the right newsgroup. Sorry, if not!
In my EMF model I have a class B which extends class A. In A there is a
String attribute 'name'.
While still playing with the OCL constraint stuff :), I just wanted to
constrain the 'name' of A (and thus of B, too) to a length less than 20
characters. So I added this OCL expression to A:
self.name.size()<20
In my GMF Editor I only have instances of B and doing the validation
raises a
org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException.
The problem is in the generated method 'validateNameLength' in AImpl.
This line was generated, right after the first if:
EOperation eOperation = (EOperation) eClass().getEOperations().get(1);
Get(1) raises the exception, because there is only one operation, and
that is one from B and not from A!
So, i guess the bug is in the template? I copypasted the whole templates
folder from the employee example.
I thought I could use these templates, without modifying them, right?
Or do I have to make my own templates?
I'm completely unfamiliar with JET and templates stuff.
Thanks, Andreas