Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366223

Summary: JvmTypesBuilder.toSetter should create a JvmOperation with void returnType.
Product: [Modeling] TMF Reporter: Ingo Meyer <ingo.meyer>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sven.efftinge
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Ingo Meyer CLA 2011-12-09 11:58:23 EST
Build Identifier: 

Currently (2.2 nightly) this method creates a JvmOperation for an attribute setter with null returnType.
This will crash the XBaseCompiler if e.g. this JvmOperation is used as last argument in a XBlockExpression.
My workaround is:

// TODO restore if xtext works here! We need to have void type for this method! members += x.toSetter( x.varName, t )
val setter = x.toSetter( x.varName, t )
setter.returnType = typeRefs.getTypeForName( typeof( Void ), x )
members += setter


Reproducible: Always
Comment 1 Ingo Meyer CLA 2011-12-09 12:00:56 EST
sorry, the above code is confusing, here is the pure workaround from my JvmModelInferrer:

// TODO We need to have void type for this method!
val setter = x.toSetter( x.varName, t )
setter.returnType = typeRefs.getTypeForName( typeof( Void ), x )
members += setter
Comment 2 Ingo Meyer CLA 2011-12-09 12:33:08 EST
one more thing... ;-)

of course the primitive void should be used! so:

setter.returnType = typeRefs.getTypeForName( Void::TYPE, x )

is correct in my example case.
Comment 3 Ingo Meyer CLA 2012-11-23 04:05:22 EST
In Xtext 2.3 I see that the void type is correctly set, so closing this old one...
Comment 4 Sven Efftinge CLA 2012-11-23 04:25:15 EST
Thank you, for verifying :-)