Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Generated code and PDE API Baselines
Generated code and PDE API Baselines [message #901338] Fri, 10 August 2012 18:08 Go to next message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2233
Registered: July 2009
Senior Member
I'm working on an RCP project that uses EMF generated code; recently we introduced a PDE API baseline to help track our API changes. The problem is, when the code is re-generated from the models, it loses all the @since tags that we've added to satisfy the API Baseline tooling.

Is there some way to configure the genmodel or other trick to get it to not lose the manually inserted @since tags?
Re: Generated code and PDE API Baselines [message #901362 is a reply to message #901338] Sat, 11 August 2012 08:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26013
Registered: July 2009
Senior Member
Eric,

You should add those to the user-doc section, or specify them as
annotations in the model so they end up in the model-doc section.

On 11/08/2012 12:08 AM, Eric Rizzo wrote:
> I'm working on an RCP project that uses EMF generated code; recently
> we introduced a PDE API baseline to help track our API changes. The
> problem is, when the code is re-generated from the models, it loses
> all the @since tags that we've added to satisfy the API Baseline tooling.
>
> Is there some way to configure the genmodel or other trick to get it
> to not lose the manually inserted @since tags?
>
Re: Generated code and PDE API Baselines [message #1062261 is a reply to message #901362] Thu, 06 June 2013 15:38 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2233
Registered: July 2009
Senior Member
Sorry to revive an old thread, but I just got around to trying this out. See comments below.

Ed Merks wrote on Sat, 11 August 2012 08:36
Eric,

You should add those to the user-doc section, or specify them as
annotations in the model so they end up in the model-doc section.


So I took an existing .ecore with generated code and added a new attribute to one of the types. I then attached an EAnnotation to that attribute, like this:

<eStructuralFeatures xsi:type="ecore:EAttribute" name="foo" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
  <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
    <details key="documentation" value="@since 2.0"/>
  </eAnnotations>
</eStructuralFeatures>


When I re-generated code, it added the @since 2.0 to the model-doc section of the interface getter method, but did not include it in the setter method. Nor did it included it at all in the generated impl class or the Package interface or impl class.
However, in my case that's not nearly good enough because the API Baseline marks anything that's public as violating the baseline and thus an error until I add the @since tags manually.

Is there some way to get the EMF generator to apply the documentation EAnnotation more broadly for new attributes?

Thanks,
Eric


Quote:

On 11/08/2012 12:08 AM, Eric Rizzo wrote:
> I'm working on an RCP project that uses EMF generated code; recently
> we introduced a PDE API baseline to help track our API changes. The
> problem is, when the code is re-generated from the models, it loses
> all the @since tags that we've added to satisfy the API Baseline tooling.
>
> Is there some way to configure the genmodel or other trick to get it
> to not lose the manually inserted @since tags?
>

Re: Generated code and PDE API Baselines [message #1062267 is a reply to message #1062261] Thu, 06 June 2013 16:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26013
Registered: July 2009
Senior Member
Eric,

No, only the getter is documented. You'd have to add it elsewhere manually.


On 06/06/2013 9:38 PM, Eric Rizzo wrote:
> Sorry to revive an old thread, but I just got around to trying this
> out. See comments below.
>
> Ed Merks wrote on Sat, 11 August 2012 08:36
>> Eric,
>>
>> You should add those to the user-doc section, or specify them as
>> annotations in the model so they end up in the model-doc section.
>
>
> So I took an existing .ecore with generated code and added a new
> attribute to one of the types. I then attached an EAnnotation to that
> attribute, like this:
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="foo"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
> <details key="documentation" value="@since 2.0"/>
> </eAnnotations>
> </eStructuralFeatures>
>
>
> When I re-generated code, it added the @since 2.0 to the model-doc
> section of the interface getter method, but did not include it in the
> setter method. Nor did it included it at all in the generated impl
> class or the Package interface or impl class.
> However, in my case that's not nearly good enough because the API
> Baseline marks anything that's public as violating the baseline and
> thus an error until I add the @since tags manually.
>
> Is there some way to get the EMF generator to apply the documentation
> EAnnotation more broadly for new attributes?
>
> Thanks,
> Eric
>
>
> Quote:
>> On 11/08/2012 12:08 AM, Eric Rizzo wrote:
>> > I'm working on an RCP project that uses EMF generated code;
>> recently > we introduced a PDE API baseline to help track our API
>> changes. The > problem is, when the code is re-generated from the
>> models, it loses > all the @since tags that we've added to satisfy
>> the API Baseline tooling.
>> >
>> > Is there some way to configure the genmodel or other trick to get
>> it > to not lose the manually inserted @since tags?
>> >
>
>
Re: Generated code and PDE API Baselines [message #1062449 is a reply to message #1062267] Fri, 07 June 2013 15:02 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric Rizzo
Messages: 2233
Registered: July 2009
Senior Member
Ed Merks wrote on Thu, 06 June 2013 16:33
Eric,

No, only the getter is documented. You'd have to add it elsewhere manually.

OK, thanks. If I enter an enhancement request into bugzila do you see any change of it being adressed?

Eric



On 06/06/2013 9:38 PM, Eric Rizzo wrote:
> Sorry to revive an old thread, but I just got around to trying this
> out. See comments below.
>
> Ed Merks wrote on Sat, 11 August 2012 08:36
>> Eric,
>>
>> You should add those to the user-doc section, or specify them as
>> annotations in the model so they end up in the model-doc section.
>
>
> So I took an existing .ecore with generated code and added a new
> attribute to one of the types. I then attached an EAnnotation to that
> attribute, like this:
>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="foo"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
> <details key="documentation" value="@since 2.0"/>
> </eAnnotations>
> </eStructuralFeatures>
>
>
> When I re-generated code, it added the @since 2.0 to the model-doc
> section of the interface getter method, but did not include it in the
> setter method. Nor did it included it at all in the generated impl
> class or the Package interface or impl class.
> However, in my case that's not nearly good enough because the API
> Baseline marks anything that's public as violating the baseline and
> thus an error until I add the @since tags manually.
>
> Is there some way to get the EMF generator to apply the documentation
> EAnnotation more broadly for new attributes?
>
> Thanks,
> Eric
>
>
> Quote:
>> On 11/08/2012 12:08 AM, Eric Rizzo wrote:
>> > I'm working on an RCP project that uses EMF generated code;
>> recently > we introduced a PDE API baseline to help track our API
>> changes. The > problem is, when the code is re-generated from the
>> models, it loses > all the @since tags that we've added to satisfy
>> the API Baseline tooling.
>> >
>> > Is there some way to configure the genmodel or other trick to get
>> it > to not lose the manually inserted @since tags?
>> >
>
Re: Generated code and PDE API Baselines [message #1062518 is a reply to message #1062449] Sat, 08 June 2013 04:01 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26013
Registered: July 2009
Senior Member
Eric,

Probably things like @since and @deprecated should have specialized
support so that all derived artifacts will be marked, e.g., including
the things in the package interface. There's
https://bugs.eclipse.org/bugs/show_bug.cgi?id=276954 open for quite a
while already. The two things seem quite closely related and need to be
generated in the same places for the similar reasons so it would make
sense to address both issues at once. To be honest, it's not likely to
be my highest priority...


On 07/06/2013 9:02 PM, Eric Rizzo wrote:
> Ed Merks wrote on Thu, 06 June 2013 16:33
>> Eric,
>>
>> No, only the getter is documented. You'd have to add it elsewhere
>> manually.
>
> OK, thanks. If I enter an enhancement request into bugzila do you see
> any change of it being adressed?
>
> Eric
>
>
>
> On 06/06/2013 9:38 PM, Eric Rizzo wrote:
>> Sorry to revive an old thread, but I just got around to trying this
>> out. See comments below.
>>
>> Ed Merks wrote on Sat, 11 August 2012 08:36
>>> Eric,
>>>
>>> You should add those to the user-doc section, or specify them as
>>> annotations in the model so they end up in the model-doc section.
>>
>>
>> So I took an existing .ecore with generated code and added a new
>> attribute to one of the types. I then attached an EAnnotation to that
>> attribute, like this:
>>
>> <eStructuralFeatures xsi:type="ecore:EAttribute" name="foo"
>> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
>> <eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
>> <details key="documentation" value="@since 2.0"/>
>> </eAnnotations>
>> </eStructuralFeatures>
>>
>>
>> When I re-generated code, it added the @since 2.0 to the model-doc
>> section of the interface getter method, but did not include it in the
>> setter method. Nor did it included it at all in the generated impl
>> class or the Package interface or impl class.
>> However, in my case that's not nearly good enough because the API
>> Baseline marks anything that's public as violating the baseline and
>> thus an error until I add the @since tags manually.
>>
>> Is there some way to get the EMF generator to apply the documentation
>> EAnnotation more broadly for new attributes?
>>
>> Thanks,
>> Eric
>>
>>
>> Quote:
>>> On 11/08/2012 12:08 AM, Eric Rizzo wrote:
>>> > I'm working on an RCP project that uses EMF generated code;
>>> recently > we introduced a PDE API baseline to help track our API
>>> changes. The > problem is, when the code is re-generated from the
>>> models, it loses > all the @since tags that we've added to satisfy
>>> the API Baseline tooling.
>>> >
>>> > Is there some way to configure the genmodel or other trick to get
>>> it > to not lose the manually inserted @since tags?
>>> >
>>
>
Previous Topic:How to programmatically generate java code from .genmodel?
Next Topic:create a graphical interface with emf
Goto Forum:
  


Current Time: Fri Aug 29 08:10:13 EDT 2014

Powered by FUDForum. Page generated in 0.01820 seconds