Static profile issue generating Java with multiple redefined properties of the same extension type [message #1837635] |
Wed, 03 February 2021 14:00 |
Deniz Eren Messages: 68 Registered: March 2014 |
Member |
|
|
Hi Ed,
Here is another case, this time the generated code causes Java build errors.
Here see this example:
As you can see a Duck generalises an Animal and a CanFly stereotype. An Animal extends a NamedElement, thus contains a base_NamedElement property, which the Duck inherits. A CanFly extends also a NamedElement, thus contains another base_NamedElement property, which the Duck inherits also. To consolidate this double situation, the Duck extends a NamedElement itself and within it's own base_NamedElement property it configures the parents instances of base_NamedElement as Redefined properties for it's own base_NamedElement. Thus UML'wise, both parent stereotypes of Duck can do their jobs, together with any additional duties assigned by Duck to itself. Now I have created this simplified example, but in a real scenario these stereotypes have valid duties.
On Java generation the following line reports the error:
public static final ExecutorProperty _Duck__base_NamedElement = new EcoreExecutorProperty(ValidationProblemPackage.Literals.DUCK__BASE_NAMED_ELEMENT, Types._Duck, 0);
Clearly the instance names generated clash because they all happen to be the same. I would recommend checking the instances here and naming something like DUCK__BASE_NAMED_ELEMENT2 etc.
Error is:
Description Resource Path Location Type
DUCK__BASE_NAMED_ELEMENT cannot be resolved or is not a field ValidationProblemTables.java /com.validationproblem.profile/src-gen/com/validationproblem/profile/validationproblem line 249 Java Problem
Now if I change the extension of NamedElement to Element for the CanFly and NamedElement to Classifier for the Duck and leave the NamedElement extension of Animal as-is - the code generates, build and runs correctly:
Best regards,
Deniz
[Updated on: Wed, 03 February 2021 22:24] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02460 seconds