Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316519

Summary: Scoping problem when file doesn't exist (yet)
Product: [Modeling] TMF Reporter: Moritz Eysholdt <moritz.eysholdt>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sebastian.zarnekow
Version: 1.0.0Flags: sebastian.zarnekow: helios+
Target Milestone: SR1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Moritz Eysholdt CLA 2010-06-10 15:04:56 EDT
Steps to reproduce:

1. Create language
2. fire up your runtime workspace
3. let the xtext builder index some models
4. Trigger an action, which creates a model programmatically. The model contains cross references to the files in the workspace. serialize the model. This will lead to serialization exceptions because the cross references can not be serialized because scoping provides no global scopes because there are no visible containers because the container handle for the to-be-serialized model can not be determined because the packagesFragmentURI is not determined because the to-be-serialized-file doesn't exist yet.


Files shouldn't need to exist on the disk to be serializeable ;)

A second problem is that the cache in org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.getVisibleContainers(EObject) is not invalidated.


Stack trace of the evil "if (!file.exists()) return null;"

JavaProjectsStateHelper.getPackageFragmentRoot(URI) line: 149	
JavaProjectsStateHelper.initHandle(URI) line: 48	
JavaProjectsState.doInitHandle(URI) line: 40	
JavaProjectsState(AbstractAllContainersState).initHandle(URI) line: 102	
JavaProjectsState(AbstractAllContainersState).getContainerHandle(URI) line: 96	
StateBasedContainerManager.internalGetContainerHandle(IResourceDescription, IResourceDescriptions) line: 75	
StateBasedContainerManager.getVisibleContainers(IResourceDescription, IResourceDescriptions) line: 44	
DefaultGlobalScopeProvider.getVisibleContainers(EObject) line: 61	
DefaultGlobalScopeProvider.getScope(EObject, EReference) line: 43	
ImportedNamespaceAwareLocalScopeProvider(AbstractGlobalScopeDelegatingScopeProvider).getGlobalScope(EObject, EReference) line: 30	
ImportedNamespaceAwareLocalScopeProvider.getScope(EObject, EReference) line: 125	
ImportedNamespaceAwareLocalScopeProvider.getScope(EObject, EReference) line: 129
Comment 1 Sebastian Zarnekow CLA 2010-07-21 10:47:53 EDT
Fixed in HEAD.
Comment 2 Karsten Thoms CLA 2017-09-19 15:46:12 EDT
Closing bug which were set to RESOLVED before Eclipse Neon.0.