Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Bug with EcoreGeneratorFragment in xtext 2.4M5?
Bug with EcoreGeneratorFragment in xtext 2.4M5? [message #1015560] Fri, 01 March 2013 04:04 Go to next message
Victor Noël is currently offline Victor Noël
Messages: 112
Registered: June 2010
Senior Member
Hi,

I'm trying to work on a language based on xbase and another metamodel I wrote, which refers to JavaVMTypes.

My language refers to things from Xtypes and JavaVMTypes.

When the EcoreGeneratorFragment is executed I get this error:
java.lang.NullPointerException
	at org.eclipse.emf.codegen.ecore.genmodel.impl.GenPackageImpl.hasExtendedMetaData(GenPackageImpl.java:4417)
	at org.eclipse.emf.codegen.ecore.genmodel.impl.GenPackageImpl.initialize(GenPackageImpl.java:2807)
	at org.eclipse.emf.codegen.ecore.genmodel.impl.GenModelImpl.initialize(GenModelImpl.java:2317)
	at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.getSaveAndReconcileGenModel(EcoreGeneratorFragment.java:666)
	at org.eclipse.xtext.generator.ecore.EcoreGeneratorFragment.generate(EcoreGeneratorFragment.java:220)
	at org.eclipse.xtext.generator.CompositeGeneratorFragment.generate(CompositeGeneratorFragment.java:92)
	at org.eclipse.xtext.generator.LanguageConfig.generate(LanguageConfig.java:113)
	at org.eclipse.xtext.generator.Generator.generate(Generator.java:361)
	at org.eclipse.xtext.generator.Generator.invokeInternal(Generator.java:128)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:126)
	at org.eclipse.emf.mwe.core.lib.Mwe2Bridge.invoke(Mwe2Bridge.java:34)
	at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invoke(AbstractWorkflowComponent.java:201)
	at org.eclipse.emf.mwe2.runtime.workflow.AbstractCompositeWorkflowComponent.invoke(AbstractCompositeWorkflowComponent.java:35)
	at org.eclipse.emf.mwe2.runtime.workflow.Workflow.run(Workflow.java:19)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:102)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:74)
	at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:35)


I did a bit of debug, and the problem is that on line 4437 of GenPackageImpl, when looking for the ePackage of the references, at one point the eCrossReference is, I don't know why, a proxy to a EClass of JavaVMTypes and not a direct reference as with the other references.
And this proxy seems to return null for getEPackage(), which results on the NPE happening later.

Maybe something is wrong in my code, so I'm going to check again, but I'm not sure that behaviour is wanted when such a situation happens :)

Thanks!
Re: Bug with EcoreGeneratorFragment in xtext 2.4M5? [message #1015563 is a reply to message #1015560] Fri, 01 March 2013 04:07 Go to previous messageGo to next message
Victor Noël is currently offline Victor Noël
Messages: 112
Registered: June 2010
Senior Member
I found the problem, in the ecore file referencing JavaVMTypes, I got something like that:

<eStructuralFeatures xsi:type="ecore:EReference" name="typeParameters" upperBound="-1"
        eType="ecore:EClass platform:/plugin/org.eclipse.xtext.common.types/model/JavaVMTypes.ecore#//JvmTypeParameter"
        containment="true"/>


instead of:

<eStructuralFeatures xsi:type="ecore:EReference" name="typeParameters" upperBound="-1"
        eType="ecore:EClass platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.ecore#//JvmTypeParameter"
        containment="true"/>


Anyway, the error is maybe not normal?
Re: Bug with EcoreGeneratorFragment in xtext 2.4M5? [message #1015565 is a reply to message #1015563] Fri, 01 March 2013 04:09 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6142
Registered: July 2009
Senior Member
Hi,

did you try to add a uri map from platform:/plugin/..... to platform:/resource ...... to the StandaloneSetup?

~Christian
Re: Bug with EcoreGeneratorFragment in xtext 2.4M5? [message #1015579 is a reply to message #1015565] Fri, 01 March 2013 04:29 Go to previous messageGo to next message
Victor Noël is currently offline Victor Noël
Messages: 112
Registered: June 2010
Senior Member
Yes, I think that would work too, but I am more worried about the way the error is reported and the fact that it happens, than I am worried about how to solve it (since I could solve it :)

Thank you!
Re: Bug with EcoreGeneratorFragment in xtext 2.4M5? [message #1016095 is a reply to message #1015563] Mon, 04 March 2013 18:43 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2809
Registered: July 2009
Senior Member
Am 01.03.13 10:07, schrieb Victor Mising name:
> I found the problem, in the ecore file referencing JavaVMTypes, I got
> something like that:
>
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="typeParameters"
> upperBound="-1"
> eType="ecore:EClass
> platform:/plugin/org.eclipse.xtext.common.types/model/JavaVMTypes.ecore#//JvmTypeParameter"
>
> containment="true"/>
>
>
> instead of:
>
>
> <eStructuralFeatures xsi:type="ecore:EReference" name="typeParameters"
> upperBound="-1"
> eType="ecore:EClass
> platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.ecore#//JvmTypeParameter"
>
> containment="true"/>
>
>
> Anyway, the error is maybe not normal?

Where did you find the reference to platform:/plugin? Is it in your own
Ecore package or in one file that is shipped with Xtext?
Nevertheless, you may want to register a URI mapping in order to fix that.

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Bug with EcoreGeneratorFragment in xtext 2.4M5? [message #1016129 is a reply to message #1016095] Tue, 05 March 2013 02:52 Go to previous message
Victor Noël is currently offline Victor Noël
Messages: 112
Registered: June 2010
Senior Member
Hi,

It was in my own ecore file, so I just changed it directly in the file Smile

I think it arrived here automatically by using the simple EMF editor...
Previous Topic:Scoping
Next Topic:QNames with dots in segments
Goto Forum:
  


Current Time: Wed Jul 30 01:21:00 EDT 2014

Powered by FUDForum. Page generated in 0.37754 seconds