Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Errors in generated java code when extending Xcore
Errors in generated java code when extending Xcore [message #1381442] Sun, 25 May 2014 15:03 Go to next message
Eclipse UserFriend
Hi,
I am working on a DSL in which I want to use features from Xcore.
I added dependencies org.eclipse.emf.ecore.xcore;bundle-version="1.1.2"
to the main project and
org.eclipse.emf.ecore.xcore.ui;bundle-version="1.1.1" to the UI project,
then I created a language like this:

grammar org.xtext.example.extendedxcore.ExtendedXcore with
org.eclipse.emf.ecore.xcore.Xcore
generate extendedXcore
"http://www.xtext.org/example/extendedxcore/ExtendedXcore"
import "http://www.eclipse.org/emf/2011/Xcore" as xcore

EXcore:
package=XPackage
extension=Extension;

Extension:
'selection' name=ID '{'
selected+=Select*
'}';

Select:
'select' class=[xcore::XClass];

I then added the following lines to the Workflow file:
registerGeneratedEPackage = "org.eclipse.emf.ecore.xcore.XcorePackage"
registerGenModelFile =
"platform:/resource/org.eclipse.emf.ecore.xcore/model/Xcore.genmodel"

When I run the workflow now I get lots of errors in the generated java
files and I can't figure out how to fix that...
I pasted the list of errors here: http://pastebin.com/05sSHXhV
Most of them seem to speak of missing dependencies, but I don't know
what is missing. Any idea?

Thanks for any suggestions,
Florian
Re: Errors in generated java code when extending Xcore [message #1383789 is a reply to message #1381442] Mon, 26 May 2014 14:42 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1762
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 25/05/2014 17:03, Florian K├Ânig wrote:
> Hi,
> I am working on a DSL in which I want to use features from Xcore.
> I added dependencies org.eclipse.emf.ecore.xcore;bundle-version="1.1.2"
> to the main project and
> org.eclipse.emf.ecore.xcore.ui;bundle-version="1.1.1" to the UI project,
> then I created a language like this:
>
> grammar org.xtext.example.extendedxcore.ExtendedXcore with
> org.eclipse.emf.ecore.xcore.Xcore
> generate extendedXcore
> "http://www.xtext.org/example/extendedxcore/ExtendedXcore"
> import "http://www.eclipse.org/emf/2011/Xcore" as xcore
>
> EXcore:
> package=XPackage
> extension=Extension;
>
> Extension:
> 'selection' name=ID '{'
> selected+=Select*
> '}';
>
> Select:
> 'select' class=[xcore::XClass];
>
> I then added the following lines to the Workflow file:
> registerGeneratedEPackage = "org.eclipse.emf.ecore.xcore.XcorePackage"
> registerGenModelFile =
> "platform:/resource/org.eclipse.emf.ecore.xcore/model/Xcore.genmodel"
>
> When I run the workflow now I get lots of errors in the generated java
> files and I can't figure out how to fix that...
> I pasted the list of errors here: http://pastebin.com/05sSHXhV
> Most of them seem to speak of missing dependencies, but I don't know
> what is missing. Any idea?
>
> Thanks for any suggestions,
> Florian

Are you using Xtext 2.6.0 or Xtext 2.5.4? If you use 2.6.0 you need to
get Xcore from the emf milestones update site (the one from the standard
update site does not work with Xtext 2.6.0 yet)...

you might also have to tweak your mwe2 further.. in this blog post
http://www.lorenzobettini.it/2014/04/switching-to-xcore-in-your-xtext-language/
I describe how to use Xcore for your DSL metamodel... not strictly what
you're doing but you may have a look at the mwe2 (took me a while to
make it work...)

hope this helps
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: Errors in generated java code when extending Xcore [message #1383961 is a reply to message #1383789] Tue, 27 May 2014 13:15 Go to previous message
Eclipse UserFriend
Hi,
thanks for the info, I indeed use Xtext 2.6.0 and now I switch to 2.5.4.
Unfortunately I do not know what I could modify in the mwe2 file.. I
tried the thinks you did in your blog post, but they do not change
anything in my project.

I was playing around with the errors and there are 3 sources of error:
Screenshots:
https://www.dropbox.com/sh/ihh188cgdwtnqq7/AAB59gGRc2KbNHh9FoZRnLZDa

In the main project:
- AbstractExtendedXcoreRuntimeModule:
missing cast
- ExtendedXcoreSemanticSequencer
- unresolved import of
org.eclipse.emf.ecore.xcore.serializer.XcoreSemanticSequencer;
- unresolved superclass XcoreSemanticSequencer
I can change this to XbaseSemanticSequencer, which solves many errors
in this file
- undefined methods "sequence_X..."
these stay when changing the extends command, but when I delete these
I can run the project as EclipseApplication
- AbstractExtendedXcoreValidator
- unresolved superclass
org.eclipse.emf.ecore.xcore.validation.XcoreValidator
when I delete the extends command and the @Override statement I can
run the project

So when I simply delete the errors, I can run the project, but I do not
know, why they are there and how I can fix that automatically.

Any idea what is to do now?
Previous Topic:Extending a DSL with Plugins
Next Topic:Generate Xtext Artifacts 10 errors
Goto Forum:
  


Current Time: Fri Feb 21 13:09:47 GMT 2020

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

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

Back to the top