Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Tutorial question: IQualifiedNameProvider needs explicit type(The 15 min tutorial (extended) fails; cannot infer type)
Tutorial question: IQualifiedNameProvider needs explicit type [message #1240627] Thu, 06 February 2014 21:41 Go to next message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 387
Registered: March 2011
Senior Member
I'm going through the 15 minutes tutorial (extended), but the code for the generator from https://www.eclipse.org/Xtext/documentation.html#DomainmodelNextSteps fails to compile with the following errors on the line:

@Inject extension IQualifiedNameProvider

- Cannot infer type
- The field IQualifiedNameProvider needs an explicit type since there is no initialization expression to infer the type from.

This is rather frustrating, as it is the code taken directly (without modification) from the tutorial (with the proper imports).

Is there something missing in the tutorial? How can I fix this?

Thank you.
Re: Tutorial question: IQualifiedNameProvider needs explicit type [message #1240639 is a reply to message #1240627] Thu, 06 February 2014 22:07 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13628
Registered: July 2009
Senior Member
Hi,

which Xtext version do you use? i just gave it a try with 2.5.0/2.5.1 and it works wonderful
what is especially strange is that it thinks IQualifiedNameProvider in the name and not the type.


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Tutorial question: IQualifiedNameProvider needs explicit type [message #1240642 is a reply to message #1240639] Thu, 06 February 2014 22:11 Go to previous messageGo to next message
Christian Dietrich is currently online Christian DietrichFriend
Messages: 13628
Registered: July 2009
Senior Member
p.s: can you share a screenshot how the editor looks like

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Tutorial question: IQualifiedNameProvider needs explicit type [message #1240999 is a reply to message #1240627] Fri, 07 February 2014 10:20 Go to previous messageGo to next message
Xi Lin is currently offline Xi LinFriend
Messages: 21
Registered: January 2014
Junior Member
It should works.

Check the imports:

import com.google.inject.Inject
import org.eclipse.xtext.naming.IQualifiedNameProvider
Re: Tutorial question: IQualifiedNameProvider needs explicit type [SOLVED] [message #1241258 is a reply to message #1240999] Fri, 07 February 2014 18:07 Go to previous message
Ernesto Posse is currently offline Ernesto PosseFriend
Messages: 387
Registered: March 2011
Senior Member
I solved it, but I'm not sure what exactly was the problem. Looking in the "Problems" tab, I saw two strange errors where it was complaining about the empty space between '@Inject' and 'extension' and between 'extension' and 'IQualifiedNameProvider'. I retyped the spaces and now it works just fine. I'm not sure how it happened. I figure it was something to do with copy and paste, but I don't remember where exactly I copied it from, if it was from the website or the internal help contents, and I cannot reproduce it again. Anyway, it works now, so it can be marked as solved.

Thanks.


PS: I'm using Xtext 2.5.1.v201402030714 on

Version: Kepler Service Release 1
Build id: 20130919-0819
Previous Topic:Xtext support for multiple file extension
Next Topic:OutputConfigurationProvider with empty output-directory
Goto Forum:
  


Current Time: Fri Oct 23 06:19:10 GMT 2020

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

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

Back to the top