Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366223 - JvmTypesBuilder.toSetter should create a JvmOperation with void returnType.
Summary: JvmTypesBuilder.toSetter should create a JvmOperation with void returnType.
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-09 11:58 EST by Ingo Meyer CLA
Modified: 2012-11-23 04:25 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 :-)