Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Error "Couldn't resolve reference to JvmType" when using XImportSection and JvmTypeReferen
Error "Couldn't resolve reference to JvmType" when using XImportSection and JvmTypeReferen [message #1700375] Thu, 02 July 2015 08:54 Go to next message
Manisha Ghule is currently offline Manisha GhuleFriend
Messages: 20
Registered: June 2015
Junior Member
Hi,

I am writing grammar (inheriting from Xtype) where I need to import and refer types from other packages. Hence I made use of XImportSection and JvmTypeReference.
In my DSL, import statements do not show any error; but when using the imported type, I get following error:
Couldn't resolve reference to JvmType 'myImportType'


I tried following domainmodel example with same case and getting same error:
grammar... with org.eclipse.xtext.xbase.Xtype

generate myDsl ..

EntityModel:
	'package' name=QualifiedName
	importSection=XImportSection?
	elements+=AbstractElement*;

AbstractElement:
	Entity;

Entity:
	'entity' name=ValidID ('extends' superType=JvmParameterizedTypeReference)? '{'
		features+=Feature*
	'}';

Feature:
	Property;

Property:
	name=ValidID ':' type=JvmTypeReference;


There might be some minor thing that I missed; but I am not able to get it.
Could anyone please provide help.
Re: Error "Couldn't resolve reference to JvmType" when using XImportSection and JvmTypeRef [message #1700521 is a reply to message #1700375] Fri, 03 July 2015 08:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
you inherit from xtype. then the bindings are not done right.
so inherit from xbase or fix the bindings e.g.

public void configureIScopeProviderDelegate(com.google.inject.Binder binder) {
		binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class).annotatedWith(com.google.inject.name.Names.named(org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider.class);
	}


and please file a ticket for that


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Error "Couldn't resolve reference to JvmType" when using XImportSection and JvmTypeRef [message #1700539 is a reply to message #1700521] Fri, 03 July 2015 12:05 Go to previous messageGo to next message
Manisha Ghule is currently offline Manisha GhuleFriend
Messages: 20
Registered: June 2015
Junior Member
Thank you Christian.

My first choice was using Xbase since I also need to support expressions in my DSL; however I was facing issues with scoping and my expressions do not contain assignments. So stuck to Xtype.

However, binding fixes import issue.
I am using Xtext 2.7.3 version. I will first verify the issue on latest Xtext version and file a ticket
Re: Error "Couldn't resolve reference to JvmType" when using XImportSection and JvmTypeRef [message #1700687 is a reply to message #1700539] Mon, 06 July 2015 13:13 Go to previous messageGo to next message
Manisha Ghule is currently offline Manisha GhuleFriend
Messages: 20
Registered: June 2015
Junior Member
Hi,

I tried to check mentioned issue on Xtext 2.8.3 (Eclipse Luna SR2); but I am not able to create my dsl in the first place. Getting following errors:

java.lang.NoClassDefFoundError: org/eclipse/xtext/xbase/serializer/XtypeSemanticSequencer
 java.lang.ClassNotFoundException: org.eclipse.xtext.xbase.serializer.XtypeSemanticSequencer cannot be found by org.xtext.example.mydsl_1.0.0.qualifier
Re: Error "Couldn't resolve reference to JvmType" when using XImportSection and JvmTypeRef [message #1700690 is a reply to message #1700687] Mon, 06 July 2015 13:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
maybe you should add deps to xbase to manifest.mf

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Error "Couldn't resolve reference to JvmType" when using XImportSection and JvmTypeRef [message #1700698 is a reply to message #1700690] Mon, 06 July 2015 14:13 Go to previous messageGo to next message
Manisha Ghule is currently offline Manisha GhuleFriend
Messages: 20
Registered: June 2015
Junior Member
Filed a ticket: https://bugs.eclipse.org/bugs/show_bug.cgi?id=471923
Re: Error "Couldn't resolve reference to JvmType" when using XImportSection and JvmTypeRef [message #1703192 is a reply to message #1700690] Wed, 29 July 2015 09:09 Go to previous messageGo to next message
Manisha Ghule is currently offline Manisha GhuleFriend
Messages: 20
Registered: June 2015
Junior Member
Hi Christian,

I am facing another issue with accessing types from same package.
I need to explicitly write an import statement for types present in same package.

Any idea how to avoid this?
Re: Error "Couldn't resolve reference to JvmType" when using XImportSection and JvmTypeRef [message #1703196 is a reply to message #1703192] Wed, 29 July 2015 09:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
nope you have to digg into the importednamespacewarelocalscopeprovider (maybe there is no implicit Import created)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Error "Couldn't resolve reference to JvmType" when using XImportSection and JvmTypeRef [message #1703820 is a reply to message #1703196] Wed, 05 August 2015 08:35 Go to previous messageGo to next message
tam ay is currently offline tam ayFriend
Messages: 44
Registered: May 2015
Member
No Message Body
Re: Error "Couldn't resolve reference to JvmType" when using XImportSection and JvmTypeRef [message #1707666 is a reply to message #1703196] Tue, 08 September 2015 12:26 Go to previous message
Manisha Ghule is currently offline Manisha GhuleFriend
Messages: 20
Registered: June 2015
Junior Member
Hi,

Could not check this issue in the meantime due to other work.
But, checked now and got following solution:
Implement MyDslXImportSectionNamespaceScopeProvider (similar to this post ) and replace XImportSectionNamespaceScopeProvider binding in RuntimeModule with this provider.

Note: I also had to implement MyDslQualifiedNameProvider
Previous Topic:Test Content-Assist withing maven build
Next Topic:xmi model of ecore to xtext model
Goto Forum:
  


Current Time: Fri Apr 19 21:45:54 GMT 2024

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

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

Back to the top