Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Static profile issue generating Java with multiple redefined properties of the same extension type(Papyrus profile issue)
Static profile issue generating Java with multiple redefined properties of the same extension type [message #1837635] Wed, 03 February 2021 14:00 Go to next message
Deniz Eren is currently offline Deniz ErenFriend
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:
index.php/fa/39912/0/

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:
index.php/fa/39913/0/



Best regards,
Deniz

[Updated on: Wed, 03 February 2021 22:24]

Report message to a moderator

Re: Static profile issue generating Java with multiple redefined properties of the same extension ty [message #1837666 is a reply to message #1837635] Wed, 03 February 2021 23:14 Go to previous message
Deniz Eren is currently offline Deniz ErenFriend
Messages: 68
Registered: March 2014
Member
Bug ticket created: https://bugs.eclipse.org/bugs/show_bug.cgi?id=570891
Previous Topic:Static profile OCL expressions referring extension_* results in exception throwing Java code
Next Topic:Papyrus static profile Java does not detect stereotypes applied to imported package element
Goto Forum:
  


Current Time: Thu Apr 25 13:46:28 GMT 2024

Powered by FUDForum. Page generated in 0.02460 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top