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

Bug 356719

Summary: [xtext] Linking fails when AutoBuild is disabled
Product: [Modeling] TMF Reporter: Laurent <laurent.hubert>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: Holger.Schill, sebastian.zarnekow, sven.efftinge
Version: unspecified   
Target Milestone: ---   
Hardware: Macintosh   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Laurent CLA 2011-09-05 06:25:36 EDT
Build Identifier: Build id: I20110613-1736

If AutoBuild (Project -> Build Automatically) is disabled and the project has been cleaned, then the linking of objects defined in other resources fails.
It seems that the IBuilderState is empty, while it is used by DirtyStateAwareResourceDescriptions, which is used by the DefaultGlobalScopeProvider.

Reproducible: Always

Steps to Reproduce:
1. have a language that uses a global scope provider extending DefaultGlobalScopeProvider to resolve external references
2. write 2 source files: one (f1) defining a reference-able entity, and another file (f2) that uses the first one (reference the entity defined in f1). Save the files, close f1, keep f2 opened. The reference is actually linked (and can be navigated, e.g., with F3).
3. disable AutoBuild (Project > Build automatically) in the Eclipse that uses the plug-in being developed.
4. clean the project (Project > Clean...)
5. the reference in the source files are not linked anymore (warning displayed and cannot be navigated anymore).
Comment 1 Holger Schill CLA 2011-09-12 08:20:12 EDT
When the checkbox "Start a build immediately" in the dialog to clean projects is checked the described problem is not reproduceable. Could you please verify.
Comment 2 Laurent CLA 2011-09-12 08:57:11 EDT
Yes indeed, "Start a build immediately" ensures that the project is built and linking works. Although, by modifying the sources, the descriptions saved during build may become outdated and linking may not work as intended.
Comment 3 Holger Schill CLA 2011-09-13 02:53:25 EDT
This is true for Java too. So this is the expected behavior. The default global scope is contructed through a builder. If the automatic build is disabled the scope gest outdated.
Comment 4 Laurent CLA 2011-09-13 10:09:29 EDT
There must be something I do wrong.
In Java, when I disable AutoBuild and clean the project, global references are NOT marked as errors (but incorrect references are, which means that some linking is done).  It is also possible to Open Declaration (F3), or find References, which is not possible for languages implemented with XText.
Comment 5 Sebastian Zarnekow CLA 2011-09-13 10:13:45 EDT
That may be true for Java.
However, Xtext's default linking is based on the index which is populated by a builder. We will not reimplement all the infrastructure as the JDT guys did.