Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Creating Proxies from JvmType(Error "'JvmType' is not a valid classifier" in TypeFactoryImpl)
Creating Proxies from JvmType [message #982159] Tue, 13 November 2012 00:40 Go to next message
Jens-Uwe Moeller is currently offline Jens-Uwe MoellerFriend
Messages: 12
Registered: March 2012
Location: Hamburg
Junior Member
Hi,

I tried out Michael Vorburgers approach to XML-Generation of the parsed Code in my DSL and it works fine, as long as my self-defined classes are concerned.
As far, as I understood his approach, he makes a kind of copy of the resource with all its element and copies all references, and then modifies it to meet XML needs (uri name:/ etc.)

Ok, it worked fine for the Fowler-Dsl StateMachine, but when having a parser rule that uses JvmTypeReference or something else from JvmType like the Enitity-Rule

Entity: 
    name=ValidID ('extends' superType=JvmParameterizedTypeReference)?

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


it gets as error: The class 'JvmType' is not a valid classifier
coming from the TypesFactory "org.eclipse.xtext.common.types.impl.TypesFactoryImpl".

There
	public EObject create(EClass eClass)
	{
		switch (eClass.getClassifierID())

the call of eClass.getClassifierID() always results in 0.

First I thought, that the error might result from a non-initialized resource or an anyway other incomplete state, so I subclassed JvmModelAssociator, and later the JvmModelGenerator. But even in the latter case the error stayed. So there must be another reason. I expected there a "JvmParameterizedTypeReference" instead of a "JvmType" - but maybe my expectation is wrong.

Either it is wrong, to try to create a proxy by calling EcoreUtil.create with
eReference.getEReferenceType()
where eReference is inititialised by the following code from Michael
protected <T extends EObject> void replaceReferences(T rootObject, ReferenceReplacer r) {
        Map<EObject, Collection<Setting>> map = EcoreUtil.CrossReferencer.find(Collections.singleton(rootObject));
        for (Map.Entry<EObject, Collection<EStructuralFeature.Setting>> entry : map.entrySet()) {
            EObject crossReference = entry.getKey();
            for (Setting setting : entry.getValue()) {
                EReference eReference = (EReference)setting.getEStructuralFeature();

or the TypesFactory has to be broadend.

Can you help me to understand, how proxies of elements of Jvm... could be build and which are the relevant objects that proxies have to be build from.

Thanks in advance, Jens
Re: Creating Proxies from JvmType [message #984806 is a reply to message #982159] Thu, 15 November 2012 00:45 Go to previous messageGo to next message
Jens-Uwe Moeller is currently offline Jens-Uwe MoellerFriend
Messages: 12
Registered: March 2012
Location: Hamburg
Junior Member
Isn't there anybody, just giving me a hint?
Jens
Re: Creating Proxies from JvmType [message #985552 is a reply to message #984806] Thu, 15 November 2012 13:42 Go to previous message
Aaron Digulla is currently offline Aaron DigullaFriend
Messages: 258
Registered: July 2009
Location: Switzerland
Senior Member
Not sure but shouldn't that be

name=ValidID ('extends' superType=[JvmParameterizedTypeReference])?


(i.e. square brackets around the reference)

And did you import "http://www.eclipse.org/xtext/common/JavaVMTypes" somewhere?
Previous Topic:Allow keywords in any order
Next Topic:Name validation for imported files
Goto Forum:
  


Current Time: Tue Apr 23 10:53:51 GMT 2024

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

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

Back to the top