eclipse-xtext / eclipse-xtext/xtext
Xtend Active annotation that remove Declaration raise BatchLinkableResourceStorageWritable messages
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 831
- Forks
- 330
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 12
Description
I have a project where I move some declaration (FieldDeclaration and MethodDeclaration) from one class to another using xtend active annotations
This was working fine with xtend 2.25 but since I moved to xtend 2.27 I get a lot of errors in the Error log such as:
org.eclipse.xtext.xbase.resource.BatchLinkableResourceStorageWritable - Object (JvmParameterizedTypeReference: (type uri: platform:/resource/test_remove_with_annotation/src/test_remove_with_annotation/TestClass.xtend#|3)) is not contained in any resource
I've extracted a subset of the active annotation that illustrate the issue (on Field only but the same occurs when deleting Method)
Annotation code:
@Retention(RetentionPolicy::RUNTIME)
@Active(typeof(MyAnnotationProcessor))
@Target(ElementType.TYPE)
annotation MyAnnotation {
}
class MyAnnotationProcessor extends AbstractClassProcessor {
/**
* Phase 2: Transform class' fields and methods
*/
override doTransform(List<? extends MutableClassDeclaration> classes, extension TransformationContext context) {
val List<MutableFieldDeclaration> toRemove = newArrayList
for (clazz : classes) {
// remove fields starting with "_"
for (f : clazz.declaredFields) {
if(f.simpleName.startsWith("_")) {
toRemove.add(f)
}
}
}
toRemove.forEach[ f | f.remove]
}
}
The code generated in xend-gen is Ok (cf. screenshot
Annotation project (run in the first Eclipse):
annotation_projet.zip
Annotated project (run in the runtime workbench):
annotated_projet.zip

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the attached annotation and annotated projects using Xtend 2.27, starting from MyAnnotationProcessor.doTransform and the generated xend-gen output. Compare field removal with the reported BatchLinkableResourceStorageWritable messages; done when the declarations are removed without those errors and the generated code remains correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100