| Summary: | Changing properties doesn't update the Java annotations when @generated is missing | ||
|---|---|---|---|
| Product: | [Modeling] EMF | Reporter: | Aaron Digulla <digulla> |
| Component: | Tools | Assignee: | Dave Steinberg <davidms> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | minor | ||
| Priority: | P3 | CC: | Ed.Merks |
| Version: | 2.2 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Aaron Digulla
As long as you ensure that the merge rule for comment merging is applicable, regeneration will update the comment correctly.
This is the merge rule:
<merge:pull
sourceMarkup="^gen$"
sourceGet="Member/getComment"
sourceTransfer="(\s*<!--\s*begin-user-doc.*?end-user-doc\s*-->\s*)\n"
targetMarkup="^gen$"
targetPut="Member/setComment"/>
This is an example to which it would be applicable:
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @model ...
* @generated
*/
String getTitle();
Note that the merge rules can be dynamically changed as part of your dynamic templates, so removing the sourceTransfer guard would change the behavior to overwrite all your comments.
Ok, "@generated" does the trick but it's confusing. May I suggest that, when @generated is missing, you only update the part after @model? Reasoning: When I created the model from the annotations, I kind of linked the annotations with the model. When I change the model, I expect the annotations to follow. This only happens for all new fields which I define in the model. So for an unknown reason, part of my Java code can be manipulated with the model editor and another part just refuses to budge. On a related note, I think the model doesn't change when I edit the old @model lines. Maybe it would really be better when the first "create EMF from Java annotations" would add @generated below every @model line to make synching the default case. Maybe it would be a good idea to have EMF add FIXMEs to the code when the model demands a certain code but the code couldn't be updated because the @generated is missing. Aaron, It's quite simple to change the merge rules, to delete the methods and allow them to be regenerated with all the necessary markup, or to insert the necessary markup at the start. And since we just don't have the resource to do everything that everyone might imagine or desire, or even to do all the really important things we'd like to do, I'm going to return this. Sorry. |