Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Problem with the deleted protected zones
[Acceleo] Problem with the deleted protected zones [message #1769532] |
Tue, 01 August 2017 11:16  |
Mad Vin Messages: 40 Registered: September 2013 |
Member |
|
|
Hello,
I'm using an old version of Acceleo (3.4.1) but i can't change it for now. I launch the generation as a Java application because the generator will be executed in standalone (outside Eclipse).
I have some errors of generation when a generated file owning protected zones is regenerated. A RejectedExecutionException is launched very often but not all the time... even if i comment some acceleo rules to generate nothing after having launched it once before, i can have this error too.
I have found this reported bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=380149#c10, which has been fixed on a later version of Acceleo. I've tried to use the alternative way described in the comments of this bug page which consists in calling the main module only once, but the problem is the root element of my model is a Package owning subpackages so the main module is called several times still.
With this solution, the RejectedExecutionException is not launched anymore, and i can regenerate the model without problem. But if i regenerate the model with some of the protected zones less, the generated file is emptied and i have the following error in the console each time the main model is called : "The file name used for the generation may be empty". But i don't know what to do to avoid this error.
Here is an example of the code producing this error :
[template public generateElement(pck : Package) ? (name = 'myPackage')]
[comment @main/]
[pck.ownedElement->filter(Class)->any(name = 'MyClass').genClass()/]
[/template]
[template public genClass(aClass : Class)]
[startFile()/]
[file ('debug.txt', false, 'UTF-8')]
[genOp()/]
[/file]
[endFile()/]
[/template]
I can launch the generation several times like this, it works. If i comment the genOp(), which generates several protected zones, after having launched the generation with it, i have the above error. And for an unknown reason, i can have too the RejectedExecutionException again instead of the "The file name used for the generation may be empty".
When i launch the generation as Acceleo Application, i have the same problem. I have the 2 problems at the same time : RejectedExecutionException and the message "The file name used for the generation may be empty".
Have you an alternative way to avoid these problems for this version of Acceleo as Java application ?
Thanks.
Regards.
[Updated on: Tue, 01 August 2017 11:39] Report message to a moderator
|
|
|
Re: [Acceleo] Problem with the deleted protected zones [message #1769863 is a reply to message #1769532] |
Fri, 04 August 2017 09:44   |
|
Hi,
I don't think this is a bug we've ever encountered on lost files, at least I don't remember about a bug corresponding to this description. I can't think of a reason you'd be getting these exceptions, so I can't really provide any hint towards a workaround. The 3.4 stream is no longer maintained apart from commercial support and quite a few bugs have been fixed since then. I'd highly suggest trying t o upgrade your environnement whenever possible .
Laurent Goubet
Obeo
|
|
|
Re: [Acceleo] Problem with the deleted protected zones [message #1769883 is a reply to message #1769863] |
Fri, 04 August 2017 13:35   |
Mad Vin Messages: 40 Registered: September 2013 |
Member |
|
|
Hi !
Thanks for the answer... For now, we cannot change the acceleo version. We think to do it later but we have some problems to analyze before with the RSA plugins and the later Acceleo version.
I have another strange problem with the protected zones with another generation main module with the same old version of Acceleo : the contents of the protected zones are ignored for an unknown reason. The start and end protected zones lines haven't changed, but their contents are deleted, and no lost files are created.
Here is the git diff :
// Start of user code InitConstructor _ZDpG8DF_EeOp1LADIcvJIL
- : AbstractHandler(id, context),
- _startLocation(0),
- _endLocation(-1),
- _complementId(NULL),
- _transaction(0),
- _waitingMessage(NULL),
- _provider(NULL),
- _operation(NULL)
+// :
+// AbstractHandler(),
+// _startLocation(),
+// _endLocation(),
+// _complementId(),
+// _transaction(),
+// _waitingMessage(),
+// _provider(),
+// _operation(),
// End of user code
{
// Start of user code Constructor _ZDpG8DF_EeOp1LADIcvJIL
- logInfo(INIT_LOG);
// End of user code
}
As you can see, the default contents of the protected zones are written, instead of keeping the previous ones. All the protected zones of the file are started and ended, and have different id. I have the same result by launching the generation in Java application or in Acceleo application, and no errors are reported in the console or in the Error Log view. I've never seen such a behaviour before. :/
Do you know what can lead to this problem ?
FYI : other files during the generation have lost some of their protected zones (this is a normal behaviour because some of their methods have been deleted from the model), and the lost files are created. So for these ones, it works well.
Thanks a lot for your support.
Regards.
[Updated on: Fri, 04 August 2017 13:38] Report message to a moderator
|
|
| |
Re: [Acceleo] Problem with the deleted protected zones [message #1770112 is a reply to message #1769891] |
Tue, 08 August 2017 13:07   |
|
Hi,
I understand the issue about the "default content" being generated for your protected areas... and I am almost certain this bug will arise as well in recent versions since it had never been encountered and thus never fixed. I think, however, that there won't be any workaround for this save for reproducing the actual "if" that prevents the generation of protected areas instead of calling the template and checking for its size. If I remember correctly, Acceleo discards protected content once it's been re-generated and, in this case, we think it has been regenerated from the "if" call. A potential fix would be to keep the content in memory I guess.
As for the indentation, the protected content will always be preserved, be it indentation or content, so we won't alter the indentation of protected code even if you change the indentation in the template.
Laurent Goubet
Obeo
|
|
| |
Goto Forum:
Current Time: Sat Dec 02 09:04:54 GMT 2023
Powered by FUDForum. Page generated in 0.04306 seconds
|