Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 316519 - Scoping problem when file doesn't exist (yet)
Summary: Scoping problem when file doesn't exist (yet)
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 1.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: SR1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-10 15:04 EDT by Moritz Eysholdt CLA
Modified: 2017-09-19 15:46 EDT (History)
1 user (show)

See Also:
sebastian.zarnekow: helios+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.