Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » IJvmModelInferrer invoked for invalid model
IJvmModelInferrer invoked for invalid model [message #999270] Fri, 11 January 2013 12:42 Go to next message
Artur S is currently offline Artur S
Messages: 2
Registered: January 2013
Junior Member
Hi,

I have a problem in my DSL with certain invalid models that are passed to the invoke method of my IJvmModelInferrer implementation.
The concrete exception I'm getting is: "An internal error occurred during XtextReconcilerJob"
The reason is that my model inferrer can't handle invalid models and thus throws exceptions.
Is this just a bug, or do do I have to deal with invalid models in the inferrer?

The (stripped down) concrete grammar is the following:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.xbase.Xbase
generate myDsl "links restricted in the forum...http //www.xtext.org/example/mydsl/MyDsl"
View:
	'view' '{'
		components+=Label+
	'}';
Label:
	'label' text=STRING;

The rest is generated code.

The inferrer is invoked for the following example:
view {
	label
}

Clearly, the "text" attribute is missing. This is reflected in the problems view and also indicated in the editor. Nevertheless, the inferrer is invoked for the invalid model.

Is this the intended behaviour?

I'm using Xtext 2.4.0M4 (provisional API), but do also get this behaviour with version 2.3.1.
When I don't use the provisional API and Xbase, the IGenerator is not passed invalid models.

Thanks and cheers, Artur
Re: IJvmModelInferrer invoked for invalid model [message #1000169 is a reply to message #999270] Mon, 14 January 2013 02:08 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2809
Registered: July 2009
Senior Member
Hi Artur,

yes, this is intentional. Your model inferrer should check your model
first before you derive invalid JVM models. It is called by the
framework since otherwise you'd end up with a great number of follow up
errors, e.g. only one label text may be missing but all other views
would not be inferred. So that's what you have to take care of by yourself.

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 11.01.13 20:14, schrieb Artur S:
> Hi,
>
> I have a problem in my DSL with certain invalid models that are passed
> to the invoke method of my IJvmModelInferrer implementation.
> The concrete exception I'm getting is: "An internal error occurred
> during XtextReconcilerJob"
> The reason is that my model inferrer can't handle invalid models and
> thus throws exceptions.
> Is this just a bug, or do do I have to deal with invalid models in the
> inferrer?
>
> The (stripped down) concrete grammar is the following:
>
> grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.xbase.Xbase
> generate myDsl "links restricted in the forum...http
> //www.xtext.org/example/mydsl/MyDsl"
> View:
> 'view' '{'
> components+=Label+
> '}';
> Label:
> 'label' text=STRING;
>
> The rest is generated code.
>
> The inferrer is invoked for the following example:
>
> view {
> label
> }
>
> Clearly, the "text" attribute is missing. This is reflected in the
> problems view and also indicated in the editor. Nevertheless, the
> inferrer is invoked for the invalid model.
>
> Is this the intended behaviour?
>
> I'm using Xtext 2.4.0M4 (provisional API), but do also get this
> behaviour with version 2.3.1.
> When I don't use the provisional API and Xbase, the IGenerator is not
> passed invalid models.
>
> Thanks and cheers, Artur
Re: IJvmModelInferrer invoked for invalid model [message #1001008 is a reply to message #1000169] Tue, 15 January 2013 16:11 Go to previous message
Artur S is currently offline Artur S
Messages: 2
Registered: January 2013
Junior Member
Okay, thanks Sebastian!
Previous Topic:xtext check annotation issue
Next Topic:juno upgrade - uml2.types
Goto Forum:
  


Current Time: Fri Aug 01 22:30:02 EDT 2014

Powered by FUDForum. Page generated in 0.06121 seconds