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

Bug 344556

Summary: [xtend] Create function should allow to explicitly define the return type
Product: [Modeling] TMF Reporter: Sebastian Zarnekow <sebastian.zarnekow>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sven.efftinge
Version: 2.0.0Flags: sebastian.zarnekow: indigo+
Target Milestone: RC1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sebastian Zarnekow CLA 2011-05-03 08:10:35 EDT
Currently the return type is the actual type of the create expression. This may expose implementation detail. A workaround is to use a cast expression but that leads to a too generic type in the initializer expression.

create MyType result: new MyTypeImpl() newMyType(String something) {
  result.setPropertyWhichIsNotInTheInterface(something);
}

This seems a little counter intuitive to me. Another option is:

MyType create result: newTypeImpl(..) newMyType(String something) {
 ..
}

which would be more in line with the definition of other operations.
Comment 1 Sven Efftinge CLA 2011-05-03 09:48:54 EDT
+1 for

MyType create result: newTypeImpl(..) newMyType(String something) {
 ..
}
Comment 2 Sebastian Zarnekow CLA 2011-05-04 05:56:40 EDT
Pushed to master.
Comment 3 Karsten Thoms CLA 2017-09-19 17:56:27 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 4 Karsten Thoms CLA 2017-09-19 18:07:18 EDT
Closing all bugs that were set to RESOLVED before Neon.0