-
Notifications
You must be signed in to change notification settings - Fork 53
Issue with active annotations depending on external model files #664
Comments
Thank you Nils for the detailed report and the example project. This sounds like a corner case where I have doubts that we can invest enough time into ATM. Please bare with us if it will take a while until we can have a deeper look into it. |
Hi @kthoms, we currently prepare a conference talk in January. In the first place it's a blocker for what we want to present there. In this context we just need a very simple generator. We currently investigate how to circumvent this issue with a Java main method (and exec-maven-plugin and m2e for IDE integration). That's not elegant, but might work for the moment. Anyway, we are keen to support you as much as we can to fix this. |
@szarnekow do you have any idea? |
Hello @kthoms, I expected this to be a corner case. However, I appreciate a fix or a suggestion for the issue. For the moment, as Oliver already told you, we will use a workaround for our generator. Thank you very much and best regards Nils |
@nils-christian i tried to follow your description but could not really find out how to "reproduce" the problem. is the problem that the xtend class does not contain the annotation that is added to the generated class? |
there is a hidden java.lang.IllegalArgumentException: The file cannot be found: /xtend-issue-b/src/main/java/de/rhocas/b/File.txt the problem is that org.eclipse.xtend.core.macro.AbstractFileSystemSupport.getPath(URI, URI, Path) cannot deal with
|
=> basePath looks bogus to me. |
relates to #383 |
org.eclipse.xtend.core.macro.AbstractFileSystemSupport.getContentsAsStream(Path) |
i wonder why the code only looks at the project config and if we should look at the workspace in eclipse. |
Hello @cdietrich, Yes, this is exactly the problem. One would expect that ActiveAnnotation3 could detect also the newly generated annotation. We also recognized the IllegalArgumentException and wondered that Eclipse "hides" this exception. |
IIRC it is related to the read tracking. When AA read files from disc, their interest in the contents of these files is recorded. If arbitrary read operations throughout the workspace would be allowed, it would not be possible to rebuild automatically if the related file contents changed. At least that would be my guess here. |
Closed as wont-fix. Feel free to reopen at github.com/eclipse/xtext |
Hi,
I would like to thank you first for providing us with Xtend. We really appreciate the language and everything that comes with it.
Now about our issue. We encountered a problem with the active annotations. I try to simplify it as much as possible. We encountered it with Xtend 2.14, but I have the same issue with an Eclipse with 2.16.
So far this works without any issues. When we change File.txt, everything is updated as expected. Now we want to use the same model file to generate some more elements in another project. It is not possible to put the model file somewhere else and reference it from another project. It seems that the active annotation can not "break out" from its project context using the FileSystemSupport etc. We therefore use the elements, generated from ActiveAnnotation1 and ActiveAnnotation2 to generate further elements.
This is where our issue occurs. ActiveAnnotation3 cannot find GeneratedAnnotation. It can only find ActiveAnnotation2 and the suppress warnings annotation. If we perform a Maven install on the project in which the class annotated with ActiveAnnotation2 lies and close it, ActiveAnnotation3 can locate GeneratedAnnotation as expected.
I created a simple project to demonstrate the issue: https://github.com/nils-christian/xtend-active-annotation-issue. It consists of four modules. Module a contains the first two active annotations. Module b uses these annotations and contains thus classes annotated with ActiveAnnotation1 and ActiveAnnotation2. Module c contains ActiveAnnotation3 which only retrieves the given class, assembles a string from all annotations and writes it as warning to the annotated class. Module d finally contains the class annotated with ActiveAnnotation3. Note how it references the class annotated with ActiveAnnotation2. If you perform a Maven install and close Module b the annotation can be found again.
Can you help us here? We tried to debug the issue. It seems that ActiveAnnotation2 is called multiple times by Eclipse. If the context is in Module b it works, but then it is called again in the context of Module d and Eclipse no longer likes the path to the model file (because it is located in another project).
Best regards
Nils Ehmke
The text was updated successfully, but these errors were encountered: