Community
Participate
Working Groups
Build Identifier: 2.0.0 Having following simple grammar grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl/MyDsl" Ergebnisklasse : 'ergebnisklasse' name=ID ('werteattribute' attribute+=ErgebnisklassenFachattribut*)? ; ErgebnisklassenFachattribut : name=ID typ=[AbstraktesDatenmodellElement|TYPID] ; TYPID : ID ; AbstraktesDatenmodellElement: Ergebnisklasse; and this simple model ergebnisklasse Test werteattribute lala . i get this nice stacktrace 0 [Worker-0] ERROR org.eclipse.xtext.linking.lazy.LazyLinkingResource - resolution of uriFragment 'xtextLink_::0.1.0::1::/2' failed. java.lang.IllegalStateException: Couldn't deresolve Test with import Test.* at org.eclipse.xtext.scoping.impl.ImportScope.getLocalElementsByName(ImportScope.java:161) at org.eclipse.xtext.scoping.impl.ImportScope.getSingleLocalElementByName(ImportScope.java:140) at org.eclipse.xtext.scoping.impl.AbstractScope.getSingleElement(AbstractScope.java:101) at org.eclipse.xtext.scoping.impl.AbstractScope.getSingleElement(AbstractScope.java:104) at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(DefaultLinkingService.java:121) at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:169) at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReference(LazyLinkingResource.java:138) at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReferences(LazyLinkingResource.java:102) at org.eclipse.xtext.EcoreUtil2.resolveLazyCrossReferences(EcoreUtil2.java:417) at org.eclipse.xtext.validation.ResourceValidatorImpl.resolveProxies(ResourceValidatorImpl.java:127) at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:62) at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec(ValidationJob.java:79) at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec(ValidationJob.java:1) at org.eclipse.xtext.util.concurrent.AbstractReadWriteAcces.readOnly(AbstractReadWriteAcces.java:32) at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:86) at org.eclipse.xtext.ui.editor.validation.ValidationJob.createIssues(ValidationJob.java:75) at org.eclipse.xtext.ui.editor.validation.ValidationJob.run(ValidationJob.java:64) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54) The Problem is that the . (dot) in the model is recognized as qualifiedname and then it trys to resolve this (empty) qualifiedname against its parent since this leads to ugly "problem occured" boxes in the ui i set this to major a workaround might be to deactivate fragment = scoping.ImportNamespacesScopingFragment {} but this is not suitable in may cases. Please not: i shortend the TYPID rule in the example -> in our case we use it to allow additional kewords in the types name Reproducible: Always
Here is the workaround that may help package org.xtext.example.mydsl; import org.eclipse.xtext.naming.IQualifiedNameConverter; import org.eclipse.xtext.naming.QualifiedName; public class MydslQualifiedNameConverter extends IQualifiedNameConverter.DefaultImpl { @Override public QualifiedName toQualifiedName(String qualifiedNameAsString) { if (".".equals(qualifiedNameAsString)) { return QualifiedName.create("."); } return super.toQualifiedName(qualifiedNameAsString); } }
Here the cleaner version of the workaround/fix public class MydslQualifiedNameConverter extends IQualifiedNameConverter.DefaultImpl { @Override public QualifiedName toQualifiedName(String qualifiedNameAsString) { if (getDelimiter().equals(qualifiedNameAsString)) { return QualifiedName.create(getDelimiter()); } return super.toQualifiedName(qualifiedNameAsString); } }
Not 2.1
I fixed it such that an ImportNormalizer returns null when resolve() is called with an empty QualifiedName. pushed to master.
Requested via bug 522520. -M.