Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » resolution of uriFragment '|29' failed.
resolution of uriFragment '|29' failed. [message #1777186] Sun, 26 November 2017 03:53 Go to next message
Amit Yadav is currently offline Amit YadavFriend
Messages: 28
Registered: June 2017
Junior Member
Running into the following exception in Idea for my xtext grammar

resolution of uriFragment '|29' failed.
java.lang.NullPointerException
	at java.util.concurrent.ConcurrentHashMap.get(ConcurrentHashMap.java:936)
	at org.eclipse.xtext.resource.impl.ChunkedResourceDescriptions.getContainer(ChunkedResourceDescriptions.java:182)
	at org.eclipse.xtext.resource.containers.ProjectDescriptionBasedContainerManager.getVisibleContainers(ProjectDescriptionBasedContainerManager.java:82)
	at org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.getVisibleContainers(DefaultGlobalScopeProvider.java:72)
	at org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.getScope(DefaultGlobalScopeProvider.java:49)
	at org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider.getScope(DefaultGlobalScopeProvider.java:61)
	at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeProvider.getScope(AbstractGlobalScopeProvider.java:50)
	at org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider.getScope(TypesAwareDefaultGlobalScopeProvider.java:43)
	at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider.getGlobalScope(AbstractGlobalScopeDelegatingScopeProvider.java:46)
	at org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider.getGlobalScope(XImportSectionNamespaceScopeProvider.java:88)
	at org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider.getScope(XImportSectionNamespaceScopeProvider.java:82)
	at org.eclipse.xtext.xbase.scoping.batch.XbaseBatchScopeProvider.delegateGetScope(XbaseBatchScopeProvider.java:63)
	at org.eclipse.xtext.xbase.scoping.batch.XbaseBatchScopeProvider.getScope(XbaseBatchScopeProvider.java:107)
	at com.linkedin.saral.dsl.scoping.SaralDSLBasicScopeProvider.getScope(SaralDSLBasicScopeProvider.java:24)
	at org.eclipse.xtext.linking.impl.DefaultLinkingService.getScope(DefaultLinkingService.java:59)
	at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(DefaultLinkingService.java:119)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:247)
	at org.eclipse.xtext.xbase.resource.BatchLinkableResource.getEObject(BatchLinkableResource.java:119)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doResolveLazyCrossReference(LazyLinkingResource.java:189)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReference(LazyLinkingResource.java:148)
	at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReferences(LazyLinkingResource.java:134)
	at org.eclipse.xtext.xbase.resource.BatchLinkableResource.resolveLazyCrossReferences(BatchLinkableResource.java:168)
	at org.eclipse.xtext.EcoreUtil2.resolveLazyCrossReferences(EcoreUtil2.java:498)
	at org.eclipse.xtext.psi.impl.BaseXtextFile.createResource(BaseXtextFile.java:149)
	at org.eclipse.xtext.psi.impl.BaseXtextFile$1.compute(BaseXtextFile.java:89)
	at com.intellij.psi.impl.PsiCachedValueImpl.doCompute(PsiCachedValueImpl.java:49)
	at com.intellij.util.CachedValueBase.getValueWithLock(CachedValueBase.java:222)
	at com.intellij.psi.impl.PsiCachedValue.getValueWithLock(PsiCachedValue.java:60)
	at com.intellij.psi.impl.PsiCachedValueImpl.getValue(PsiCachedValueImpl.java:38)
	at org.eclipse.xtext.psi.impl.BaseXtextFile.getResource(BaseXtextFile.java:108)
	at org.eclipse.xtext.psi.impl.BaseXtextFile.getINode(BaseXtextFile.java:112)
	at org.eclipse.xtext.psi.impl.XtextPsiReferenceImpl.getCrossReferenceDescription(XtextPsiReferenceImpl.java:192)
	at org.eclipse.xtext.psi.impl.XtextPsiReferenceImpl.getRangeToHighlightInElement(XtextPsiReferenceImpl.java:89)
	at org.eclipse.xtext.psi.impl.XtextPsiReferenceImpl.getRanges(XtextPsiReferenceImpl.java:143)
	at com.intellij.psi.ReferenceRange.getRanges(ReferenceRange.java:36)
	at com.intellij.psi.impl.SharedPsiElementImplUtil.addReferences(SharedPsiElementImplUtil.java:82)
	at com.intellij.psi.impl.SharedPsiElementImplUtil.findReferenceAt(SharedPsiElementImplUtil.java:49)
	at com.intellij.psi.impl.SharedPsiElementImplUtil.findReferenceAt(SharedPsiElementImplUtil.java:67)
	at com.intellij.psi.impl.PsiElementBase.findReferenceAt(PsiElementBase.java:87)
	at com.intellij.psi.SingleRootFileViewProvider.findReferenceAt(SingleRootFileViewProvider.java:498)
	at com.intellij.psi.SingleRootFileViewProvider.findReferenceAt(SingleRootFileViewProvider.java:470)
	at com.intellij.psi.impl.source.PsiFileImpl.findReferenceAt(PsiFileImpl.java:586)
	at com.intellij.codeInsight.completion.CompletionData.getReferencePrefix(CompletionData.java:143)
	at com.intellij.codeInsight.completion.CompletionData.findPrefixStatic(CompletionData.java:176)
	at com.intellij.codeInsight.completion.CompletionData.findPrefixStatic(CompletionData.java:187)
	at com.intellij.codeInsight.completion.impl.CompletionServiceImpl.createResultSet(CompletionServiceImpl.java:88)
	at com.intellij.codeInsight.completion.CompletionService.getVariantsFromContributors(CompletionService.java:80)
	at com.intellij.codeInsight.completion.CompletionService.performCompletion(CompletionService.java:110)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.a(CompletionProgressIndicator.java:831)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator.access$600(CompletionProgressIndicator.java:93)
	at com.intellij.codeInsight.completion.CompletionProgressIndicator$1CalculateItems.run(CompletionProgressIndicator.java:813)
	at com.intellij.codeInsight.completion.AsyncCompletion.b(CompletionThreading.java:108)
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:931)
	at com.intellij.codeInsight.completion.AsyncCompletion.a(CompletionThreading.java:105)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:176)
	at com.intellij.openapi.progress.impl.CoreProgressManager.a(CoreProgressManager.java:556)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:501)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:66)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:163)
	at com.intellij.codeInsight.completion.AsyncCompletion.a(CompletionThreading.java:103)
	at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:334)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)



When I take a deeper look, this is the code for the method throwing exception
@Override
  public List<IContainer> getVisibleContainers(final IResourceDescription desc, final IResourceDescriptions resourceDescriptions) {
    if ((resourceDescriptions instanceof ChunkedResourceDescriptions)) {
      final ResourceSet resourceSet = ((ChunkedResourceDescriptions)resourceDescriptions).getResourceSet();
      final ProjectDescription projectDescription = ProjectDescription.findInEmfObject(resourceSet);
      final ArrayList<IContainer> allContainers = CollectionLiterals.<IContainer>newArrayList();
      ResourceDescriptionsData _elvis = null;
      String _name = projectDescription.getName();
      ResourceDescriptionsData _container = ((ChunkedResourceDescriptions)resourceDescriptions).getContainer(_name);
      if (_container != null) {
        _elvis = _container;
      } else {
        Set<IResourceDescription> _emptySet = CollectionLiterals.<IResourceDescription>emptySet();
        ResourceDescriptionsData _resourceDescriptionsData = new ResourceDescriptionsData(_emptySet);
        _elvis = _resourceDescriptionsData;
      }
      final ResourceDescriptionsData container = _elvis;
      ResourceDescriptionsBasedContainer _resourceDescriptionsBasedContainer = new ResourceDescriptionsBasedContainer(container);
      allContainers.add(_resourceDescriptionsBasedContainer);
      [b]List<String> _dependencies = projectDescription.getDependencies();[/b]
      for (final String name : _dependencies) {
        {
          ResourceDescriptionsData _elvis_1 = null;
          ResourceDescriptionsData _container_1 = ((ChunkedResourceDescriptions)resourceDescriptions).getContainer(name);
          if (_container_1 != null) {
            _elvis_1 = _container_1;
          } else {
            Set<IResourceDescription> _emptySet_1 = CollectionLiterals.<IResourceDescription>emptySet();
            ResourceDescriptionsData _resourceDescriptionsData_1 = new ResourceDescriptionsData(_emptySet_1);
            _elvis_1 = _resourceDescriptionsData_1;
          }
          final ResourceDescriptionsData containerDep = _elvis_1;
          ResourceDescriptionsBasedContainer _resourceDescriptionsBasedContainer_1 = new ResourceDescriptionsBasedContainer(containerDep);
          allContainers.add(_resourceDescriptionsBasedContainer_1);
        }
      }
      return allContainers;
    }
    String _name_1 = ChunkedResourceDescriptions.class.getName();
    String _plus = ("expected " + _name_1);
    throw new IllegalArgumentException(_plus);
  }


The line projectDescription.getDependencies() returns a list which contains "null" objects which is what causing this error.

Any idea what could be wrong ?

Thank You,

Amit
Re: resolution of uriFragment '|29' failed. [message #1777191 is a reply to message #1777186] Sun, 26 November 2017 08:25 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12244
Registered: July 2009
Senior Member
the question would be who adds null to that list. or sets it with a list containing null. maybe ProjectDescriptionProvider

Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: resolution of uriFragment '|29' failed. [message #1777196 is a reply to message #1777191] Sun, 26 November 2017 18:03 Go to previous messageGo to next message
Amit Yadav is currently offline Amit YadavFriend
Messages: 28
Registered: June 2017
Junior Member
Thank you Christian for the pointer.

My DSL file resides in one of the module of a multi-module gradle project.
It appears that all the 'jar' dependencies for the module is getting added as "null" in the ProjectDescription for this module by the ProjectDescriptionProvider.
 public ProjectDescription getProjectDescription(final Object module) {
    if(module instanceof Module) {
      ProjectDescription _projectDescription = new ProjectDescription();
      Procedure1<ProjectDescription> _function = new Procedure1<ProjectDescription>() {
        public void apply(ProjectDescription it) {
          String _name = ((Module)module).getName();
          it.setName(_name);
          ModuleRootManager _instance = ModuleRootManager.getInstance((Module)module);
          OrderEntry[] enumerator = _instance.getOrderEntries();
          final ArrayList<String> dependencyNames = CollectionLiterals.newArrayList(new String[0]);
          Procedure1<OrderEntry> _function = new Procedure1<OrderEntry>() {
            public void apply(OrderEntry it) {
              boolean _matched = false;
              String _moduleName;
              if(it instanceof LibraryOrderEntry) {
                _matched = true;
                [b]_moduleName = ((LibraryOrderEntry)it).getLibraryName();[/b]
                dependencyNames.add(_moduleName);
              }

              if(!_matched && it instanceof ModuleOrderEntry) {
                _matched = true;
                _moduleName = ((ModuleOrderEntry)it).getModuleName();
                dependencyNames.add(_moduleName);
              }

            }
          };
          IterableExtensions.forEach((Iterable)Conversions.doWrapArray(enumerator), _function);
          it.setDependencies(dependencyNames);
        }
      };
      return (ProjectDescription)ObjectExtensions.operator_doubleArrow(_projectDescription, _function);
    } else {
      throw new IllegalArgumentException("Cannot create project description from " + module);
    }
  }


This is happening because 'ModuleLibraryOrderEntryImpl' and more specifically LibraryImpl class is retuning a 'null' name for the library.

I will try to figure out what is setting up these LibraryImpl class and why is the name being returned as 'null'.

It appears though any dependencies of type 'module' are fine since they return a valid module name. Wondering if this is a bug in ProjectDescriptionProvider code or in LibraryImpl code.

Re: resolution of uriFragment '|29' failed. [message #1777197 is a reply to message #1777196] Sun, 26 November 2017 18:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 12244
Registered: July 2009
Senior Member
Welll the state of the idea plugins is somewhere between live and dead.
They are currently not maintained since there is no maintainer
So this might be a bug or a missing feature
I don't know since I have no idea knowledge


Need professional support for Xtext, Xpand, EMF?
Go to: https://xtext.itemis.com
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: resolution of uriFragment '|29' failed. [message #1777732 is a reply to message #1777197] Sun, 03 December 2017 14:26 Go to previous message
Michael Bischoff is currently offline Michael BischoffFriend
Messages: 11
Registered: August 2012
Junior Member
Hello,
it could be related to the Java version, I remember a similar exception when I tried to run the xtext-maven-plugin using Java 9. It did not occur on the same project with JDK 8.

Best regards,
Michael
Previous Topic:Problem with OCL and Xtend code generator project
Next Topic:case insensitive in xtext grammar
Goto Forum:
  


Current Time: Wed Sep 26 08:51:56 GMT 2018

Powered by FUDForum. Page generated in 0.02232 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top