Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Model-to-Model Transformation » QVTo constructor behavior when extending transformations
QVTo constructor behavior when extending transformations [message #1688375] Fri, 20 March 2015 15:20 Go to next message
Teun van de Berg is currently offline Teun van de BergFriend
Messages: 12
Registered: October 2014
Junior Member
Hi,


I observed the following behavior for constructors, which I didn't expect:

I have two transformations A, and B. B extends A. A contains a constructor (ConsA). A also contains a mapping which uses ConsA (mappingA). I intended to overwrite this constructor in B and hence added a new implementation of ConsA in B. B utilizes mappingA. Much to my surprise the constructor from A is called rather from B. If I surround the constructor in a mapping which I also overwrite in transformation B the new constructor is used.

In pseudo code:
transformation A();
...
mapping mappingA()
{
 new ConsA();
}
ConsA::ConsA(inp:String) // The to be created object is named ConsA for this example.
{
 log("Constructor from mapping A");
}


transformation B() extends transformation A();
...
mapping X()
{
 map mappingA();
}
ConsA::ConsA(inp:String) // The to be created typeis named ConsA for this example.
{
  log("Constructor from mapping B");
}

Logs: Constructor from mapping A.

Overwriting mappingA in transformation B will result in: Constructor from mapping B.

The QVTo spec states:
Quote:

1) A constructor may be defined as an operation of the class to be constructed or may be owned by a module that plays a role of factory for the class.
2) An access import behaves as a traditional package import, whereas extension semantics combines package import and class inheritance paradigm.


Is the current behavior correct? Can I make my constructor be owned by the class rather than the module?


Kind regards,
Teun
Re: QVTo constructor behavior when extending transformations [message #1688390 is a reply to message #1688375] Fri, 20 March 2015 15:45 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Please use the qvto newsgroup for QVTo discussions.

In this case please raise a Bugzilla.

Regards

Ed Willink


On 20/03/2015 15:20, Teun van de Berg wrote:
> Hi,
>
>
> I observed the following behavior for constructors, which I didn't
> expect:
>
> I have two transformations A, and B. B extends A. A contains a
> constructor (ConsA). A also contains a mapping which uses ConsA
> (mappingA). I intended to overwrite this constructor in B and hence
> added a new implementation of ConsA in B. B utilizes mappingA. Much to
> my surprise the constructor from A is called rather from B. If I
> surround the constructor in a mapping which I also overwrite in
> transformation B the new constructor is used.
>
> In pseudo code:
>
> transformation A();
> ..
> mapping mappingA()
> {
> new ConsA();
> }
> ConsA::ConsA(inp:String) // The to be created object is named ConsA
> for this example.
> {
> log("Constructor from mapping A");
> }
>
>
> transformation B() extends transformation A();
> ..
> mapping X()
> {
> map mappingA();
> }
> ConsA::ConsA(inp:String) // The to be created typeis named ConsA for
> this example.
> {
> log("Constructor from mapping B");
> }
>
> Logs: Constructor from mapping A.
>
> Overwriting mappingA in transformation B will result in: Constructor
> from mapping B.
>
> The QVTo spec states:
> Quote:
>> 1) A constructor may be defined as an operation of the class to be
>> constructed or may be owned by a module that plays a role of factory
>> for the class. 2) An access import behaves as a traditional package
>> import, whereas extension semantics combines package import and class
>> inheritance paradigm.
>
>
> Is the current behavior correct? Can I make my constructor be owned by
> the class rather than the module?
>
>
> Kind regards,
> Teun
Re: QVTo constructor behavior when extending transformations [message #1689357 is a reply to message #1688390] Mon, 23 March 2015 11:47 Go to previous message
Teun van de Berg is currently offline Teun van de BergFriend
Messages: 12
Registered: October 2014
Junior Member
Hi,

Thanks for your confirmation that this is a bug. I'll open a Bugzilla.

Regards,
Teun
Previous Topic:many to one mapping
Next Topic:Transforming Ecore diagrams with mediniQVT
Goto Forum:
  


Current Time: Thu Apr 25 01:14:38 GMT 2024

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

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

Back to the top