|
|
|
Re: Redefined property type in Genmodel [message #478173 is a reply to message #478170] |
Fri, 06 February 2009 17:05 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Hi Rimvydas,
The code generation is probably a result of the Java 1.4 days when those
co-variant returns were not allowed.
This is probably a worth while issue to investigate further, please raise a
bugzilla if this is a problem for you.
Even though we could produce an API with multiple getX(), setX() of
different types, would this result in a confusing API ?
Cheers,
- James.
"Rimvydas " <rimvydas@nomagiclt.com> wrote in message
news:b2d167e486e4ef6f1ef49501a0ed5087$1@www.eclipse.org...
> Hi James,
>
> Thanks for your answer.
> The property x in class B appears in 'duplicates' annotation. So As I
> understand the property will be ignored by the code generator. Actually I
> would like to generate method B::getX() that returns type D (this is legal
> starting from java 1.5).
>
> The code generated from what you describe would produce A::getX() and
> B::getX() impl's. The problem is that in Java, one cannot dis-inherit
> properties/operations so the best outcome would be to produce one
> B::getX()
> of the more general type C that overrides the getter from A.
> I would recommend renaming the x from B to something else and then
> reloading
> your genmodel. I believe that would reproduce what you may expect.
>
> Cheers,
> - James.
>
> "Rimvydas " <rimvydas@xxxxxxxx> wrote in message
> news:76cb60fdce2cbc2188815f11a40097e6$1@xxxxxxxxe.org...
>
> I have UML model with classes A, B, C and D. B extends A and D extends
> C.
> Class A has a property "x" of type C. Class B has a property "x" of
> type D
> and this property redefines property "x" in class A. After creating a
> genmodel from the uml model in the ecore file I see that the class B
> has
> annotation "duplicates" and property "x" inside it BUT the type of the
> property is C.
>
> Why the redefined property type in genmodel was changed to the type
> from
> which the property was redefined?
>
|
|
|
|
|
Re: Redefined property type in Genmodel [message #627373 is a reply to message #478170] |
Fri, 06 February 2009 17:05 |
james bruck Messages: 1724 Registered: July 2009 |
Senior Member |
|
|
Hi Rimvydas,
The code generation is probably a result of the Java 1.4 days when those
co-variant returns were not allowed.
This is probably a worth while issue to investigate further, please raise a
bugzilla if this is a problem for you.
Even though we could produce an API with multiple getX(), setX() of
different types, would this result in a confusing API ?
Cheers,
- James.
"Rimvydas " <rimvydas@nomagiclt.com> wrote in message
news:b2d167e486e4ef6f1ef49501a0ed5087$1@www.eclipse.org...
> Hi James,
>
> Thanks for your answer.
> The property x in class B appears in 'duplicates' annotation. So As I
> understand the property will be ignored by the code generator. Actually I
> would like to generate method B::getX() that returns type D (this is legal
> starting from java 1.5).
>
> The code generated from what you describe would produce A::getX() and
> B::getX() impl's. The problem is that in Java, one cannot dis-inherit
> properties/operations so the best outcome would be to produce one
> B::getX()
> of the more general type C that overrides the getter from A.
> I would recommend renaming the x from B to something else and then
> reloading
> your genmodel. I believe that would reproduce what you may expect.
>
> Cheers,
> - James.
>
> "Rimvydas " <rimvydas@xxxxxxxx> wrote in message
> news:76cb60fdce2cbc2188815f11a40097e6$1@xxxxxxxxe.org...
>
> I have UML model with classes A, B, C and D. B extends A and D extends
> C.
> Class A has a property "x" of type C. Class B has a property "x" of
> type D
> and this property redefines property "x" in class A. After creating a
> genmodel from the uml model in the ecore file I see that the class B
> has
> annotation "duplicates" and property "x" inside it BUT the type of the
> property is C.
>
> Why the redefined property type in genmodel was changed to the type
> from
> which the property was redefined?
>
|
|
|
Powered by
FUDForum. Page generated in 0.04090 seconds