Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350695 - [xtext][grammar] Grammar's qualified name in index contains only one segment
Summary: [xtext][grammar] Grammar's qualified name in index contains only one segment
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-29 08:21 EDT by Johan Wannheden CLA
Modified: 2017-09-19 18:15 EDT (History)
2 users (show)

See Also:
sebastian.zarnekow: indigo+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johan Wannheden CLA 2011-06-29 08:21:16 EDT
Build Identifier: I20110613-1736

The default qualified names provider does not correctly split qualified names into segments (the wrong '::' delimiter is used) when linking objects.

Reproducible: Always

Steps to Reproduce:
1. Create Xtext grammar with rule 'grammar=[xtext::Grammar|QualifiedName]'
2. Try linking to exported Domainmodel grammar instance
3. Failure to link with message "The feature 'language' of 'com.x.y.z.CatalogImpl@5cdf858e{platform:/resource/com.x.y.z.tests/src/test/Sample.check#//@catalog}'
   contains an unresolved proxy 'org.eclipse.xtext.impl.GrammarImpl@4a378244{platform:/resource/com.x.y.z.tests/src/test/Sample.check#xtextLink_::0.1::4::/6}'"

Workaround: overwrite *org.eclipse.xtext.xtext.XtextLinkingService.getLinkedObjects(EObject, EReference, INode)*
Comment 1 Sebastian Zarnekow CLA 2011-06-29 17:35:33 EDT
See XtextQualifiedNameProvider.

Simplest workaround if you want to link to an Xtext grammar:

Override DefaultLinkingService#getLinkedObjects and query the scope with a hand-made qualified name when the grammar should be resolved. Downside: Imports don't work.
Comment 2 Sebastian Zarnekow CLA 2011-08-15 15:31:01 EDT
Since this is the first complaint on the wrong exported name, I assume that other languages, that refer to a grammar, use classpath uris to load it (e.g. code templates or Xtext itself). I'll fix the exported name and won't export a grammar instance twice. Any objections?
Comment 3 Sebastian Zarnekow CLA 2011-08-15 15:48:58 EDT
Pushed to master.
Comment 4 germund CLA 2012-01-18 09:08:26 EST
The problem Johan described is still reproducible with Xtext 2.2.1.
Comment 5 Sebastian Zarnekow CLA 2012-01-18 09:21:37 EST
(In reply to comment #4)
> The problem Johan described is still reproducible with Xtext 2.2.1.

I cannot reproduce what you describe. I would assume that the index in your workspace contains obsolete entries for grammars? Did you try a clean build?
Comment 6 germund CLA 2012-01-18 10:00:01 EST
I've tried running a clean build but the problem persists, the grammar won't be found. So we still need the workaround (which I was attempting to remove) with a hand-made qualified name when querying the scope in getLinkedObjects.
Comment 7 Sebastian Zarnekow CLA 2012-01-18 10:08:28 EST
My test grammar:

grammar org.some.Sample with org.eclipse.xtext.common.Terminals

generate sample "sample"
import "http://www.eclipse.org/2008/Xtext"

Model:
	name=QualifiedName '{'
		imports+=Import*
		grammarRef+=GrammarRef*
	'}'
;

GrammarRef:
	'ref' name=ID ('in' ^grammar=[Grammar|QualifiedName])? 
;

Import:
	'import' importedNamespace=QualifiedNameWithWildcard
;

QualifiedNameWithWildcard:
	QualifiedName '.*'?
;

QualifiedName:
  ID ('.' ID)*;


====
The test models:

org.abc {
	import org.xyz.*
	ref Thing in Sample 
	ref Thing2 in org.xyz.Sample 
}

===

grammar org.xyz.Sample

generate model "model"

Model: {Model} "STRING";

=== 

Could you please provide more details about your concrete setup?
Comment 8 germund CLA 2012-01-18 11:34:16 EST
Actually, qualified names _are_ now being correctly split into segments. So given the bug description, this bug has been fixed. So we have a local problem in our implementation that is merely related to this entry, my bad. Case closed.
Comment 9 Karsten Thoms CLA 2017-09-19 18:05:54 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 10 Karsten Thoms CLA 2017-09-19 18:15:45 EDT
Closing all bugs that were set to RESOLVED before Neon.0