Community
Participate
Working Groups
LiveShadowedResourceDescriptions behaves bogus if you call org.eclipse.xtext.resource.impl.LiveShadowedResourceDescriptions.getAllResourceDescriptions() without un-lazy-ing the collection e.g. inside a forloop and resolve the stuff into the resourceset e.g. val index = resourceDescriptionsProvider.getResourceDescriptions(context.eResource) val resourceDescription = index.getResourceDescription(context.eResource.URI) val containers = manager.getVisibleContainers(resourceDescription, index) ?: emptyList for (container : containers) { val greetings = container.getExportedObjectsByType(MyDslPackage.Literals.GREETING) for (greeting : greetings) { val result = EcoreUtil2.resolve(greeting.getEObjectOrProxy, context) as Greeting println(result.name + " visited") } } through the filtering !isExistingOrRenamedResourceURI(input.getURI()); all resource descriptions but the first are removed by the lazy collection => you have to do something like for (greeting : greetings.toList)
@Sven @Moritz what do you think? is there a point where could "freeze" the resources map of the resourceset?
We cannot 'freeze' it as that changes the behavior and breaks users. I would simply not use LiveShadowedResourceDescriptions. I think we should deprecate and eventually delete it.
The LiveShadowedResourceDescriptions is needed by users that programmatically modify their EMF model and later serialize it using Xtext, e.g. graphical editors with Xtext-persistence. The LiveShadowedResourceDescriptions is needed to make sure cross references are serialized with the names from the model. Other implementation only use names from persisted files and/or Xtext's dirty state. So I oppose deprecating LiveShadowedResourceDescriptions unless we have a better solution for the use case.
yes we use LiveShadowedResourceDescriptions to be able to serialize multiple models referring each other from eclipse without turning off scope validation inside CrossRefSerializer. this way was proposed by Moritz here as well: https://www.eclipse.org/forums/index.php/m/1732573/?srch=LiveScopeResourceSetInitializer#msg_1732573
(In reply to Sven Efftinge from comment #2) > We cannot 'freeze' it as that changes the behavior and breaks users. > I would simply not use LiveShadowedResourceDescriptions. > I think we should deprecate and eventually delete it. I object. LSRD has been initially created for rename refactoring and it is definitively needed there.
*** Bug 494444 has been marked as a duplicate of this bug. ***