Extending grammar - NoClassDefFoundError [message #830284] |
Tue, 27 March 2012 12:36 |
Alex G Messages: 96 Registered: January 2012 |
Member |
|
|
Hi!
I am extending a grammar DSL1 with DSL2.
When I create a file in the editor with the extension of the DSL2 grammar, I get the following error:
Head: "Creation problems"
"Internal error: java.lang.NoClassDefFoundError
org/xtext/examples/mydsl/validation/MyDSLJavaValidator"
Furthermore, if I go to the properties for my DSL2-project, I see on the left side options for both dsls DSL1 and DSL2, but when I click on DSL2, the options field to the right does not show up, I mean the field where I can find the option "Enable project specific settings".
What I have done in order to create the grammar extension:
(1) I have added each of the three projects mydsl, mydsl.tests and mydsl.ui to the projects on the build path for each of the three projects for DSL2.
(2)
// The following two lines can be removed, if Xbase is not used.
// registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage"
// registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel"
registerGeneratedEPackage = "org.xtext.example.mydsl.mydsl.MyDSLPackage"
registerGenModelFile = "platform:/resource/org.xtext.example.mydsl/src-gen/org/xtext/example/mydsl/MyDSL.genmodel"
This works, since the building the MWE2 workflow is working without errors.
(3) In the grammar of DSL2: (something like)
grammar org.xtext.example.mydsl2.MyDsl2 with org.xtext.example.mydsl.MyDSL
generate mydsl2 "http://www.xtext.org/example/mydsl2/MyDSL2"
import "http://www.xtext.org/example/mydsl/MyDSL" as mydsl
with an overwritten rule in order to extend the grammar.
This compiles also nicely.
(4) In DSL1 I am using XTend in order to create the validation: The java validator extends the XTend validator and this again extends the Abstract
public class MyDSLJavaValidator extends MyDSLXTendValidator
[code}
class MyDSLXTendValidator extends AbstractMyDSLJavaValidator
[/code]
In the bin directory I have the org/xtext/examples/mydsl/validation/MyDSLJavaValidator file, which is not found:
\bin\org\xtext\example\mydsl\validation\MyDSLJavaValidator.class
I don't know where the problem could be! Am I missing something?
Best regards,
Alex.
|
|
|
|
Re: Extending grammar - NoClassDefFoundError [message #831814 is a reply to message #830341] |
Thu, 29 March 2012 11:37 |
Alex G Messages: 96 Registered: January 2012 |
Member |
|
|
Hi!
The problem I had, is that I had not added the plugin 1 to the dependencies in the Manifest of DSL2.
But now there are other problems:
After adding it, I had to
* extend MyDSL2RuntimeModule from MyDSL1RuntimeModule and
* extend MyDSL2StandaloneSetup from MyDSL1StandaloneSetup.
With these extensions I could use some custom implementations from MyDsl1 like scoping.
But there arose another problem:
java.lang.NoClassDefFoundError: org/xtext/example/myDSL1/ui/contentassist/MyDSL1ProposalProvider
Ok, so lets extend: MyDSL2UIModule from MyDSL1UIModule
When doing this, and starting the editor again, the editor for DSL2 does not even start now .
Am I doing something completely wrong? When I want to extend a grammar and use all of the basic functionality of the first grammar, do I have to extend each of the classes individually, like ScopeProvider, LabelProvider, QualifiedNameProvider, ... - or is there a location (e.g. in the MWE2 of DSL2?) where I can get all of these functionality extensions for "free"?
Furthermore: If I extend a grammar, do I really have to copy&paste the starting rule of DSL1 or is there another way?
Alex.
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03745 seconds