Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xbase generation exception
xbase generation exception [message #895566] Fri, 13 July 2012 15:06
Frantisek Kocun is currently offline Frantisek KocunFriend
Messages: 16
Registered: July 2009
Junior Member
Hi, I got exception when I try to generate XExpression
Caused by: java.lang.ClassCastException: org.eclipse.xtext.common.types.access.jdt.JdtTypeProvider cannot be cast to org.eclipse.xtext.common.types.access.impl.ClasspathTypeProvider
	at org.eclipse.xtext.common.types.access.ClasspathTypeProviderFactory.findTypeProvider(
	at org.eclipse.xtext.common.types.access.ClasspathTypeProviderFactory.findTypeProvider(
	at org.eclipse.xtext.common.types.access.AbstractTypeProviderFactory.findOrCreateTypeProvider(
	at org.eclipse.xtext.common.types.util.TypeReferences.findDeclaredType(

Generating XExpression in tutorial "Five simple steps to your JVM language" works like the a charm. I did it this way:
xbaseCompiler.toJavaStatement(xExpression, res, false)

But we don't have the same setup as in tutorial. We start generator on a click on button in Eclipse (because we have more generators to choose from) when element in xtext file is selected. To generate we load resources like this (our model can be split in several files):
	protected ResourceSet loadResourceSet(IProject project)
		// creates empty ResourceSet based on the given project
		XtextResourceSet  resourceSet = (XtextResourceSet) resourceSetProvider.get(project);

		// get Xtext index
		IResourceDescriptions index = resourceDescriptionsProvider.createResourceDescriptions();
		resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);

		// iterate over every resource descriptor (each describes exactly 1 file)
		for (IResourceDescription rd : index.getAllResourceDescriptions())
			// load eagerly iterated Resource to ResourceSet
			if(rd.getURI().toString().contains("") || rd.getURI().toString().contains(""))
			resourceSet.getResource(rd.getURI(), true);

		return resourceSet;

Does anyone know where the problem is?
And we use xtext version 2.2.1.v201112130541.



[Updated on: Fri, 13 July 2012 15:17]

Report message to a moderator

Previous Topic:xbase API stability?
Next Topic:Xcore validation
Goto Forum:

Current Time: Sun Sep 20 15:39:04 GMT 2020

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

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

Back to the top