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

Bug 363016

Summary: [Xtend] support for field initializers
Product: [Modeling] TMF Reporter: Sven Efftinge <sven.efftinge>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: sebastian.zarnekow
Version: 2.1.0Flags: sven.efftinge: juno+
Target Milestone: M4   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sven Efftinge CLA 2011-11-07 02:31:04 EST

    
Comment 1 Sven Efftinge CLA 2011-11-12 07:04:50 EST
The syntax is going to be just like in Java, with the difference that you can write anything there because in Xtend statements doesn't exist:

class MyClass {
  
  String name = "Horst"

  String greeting = "Hello "+name

}
Comment 2 Sebastian Zarnekow CLA 2011-11-22 13:30:30 EST
Type inference for fields would be syntactically ambigious:

extension TypeName typeNameOrFieldName = "initialValue"

vs

extension TypeName
typeNameOrFieldName = "initialValue"

thus I'll use a mandatory type for now:

extension TypeName 
TypeName typeNameOrFieldName = "initialValue"
Comment 3 Sebastian Zarnekow CLA 2011-11-28 05:55:59 EST
Pushed to master.
Comment 4 Karsten Thoms CLA 2017-09-19 16:54:53 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 5 Karsten Thoms CLA 2017-09-19 17:05:43 EDT
Closing all bugs that were set to RESOLVED before Neon.0