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

Bug 351296

Summary: [xtend] Make extension name optional
Product: [Modeling] TMF Reporter: Karsten Thoms <karsten.thoms>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: jan, sebastian.zarnekow, sven.efftinge
Version: 2.0.0Flags: sebastian.zarnekow: indigo+
Target Milestone: SR2   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Karsten Thoms CLA 2011-07-06 05:59:56 EDT
The name of included extensions in Xtend classes is mandatory, but normally there is no reason to use the extension instance directly in the Xtend code. It would be better if the variable name is optional and inferred internally.

class MyXtendClass {
  @Inject MyExtension  // omit myExtensionName
}
Comment 1 Jan Koehnlein CLA 2011-07-06 06:05:27 EDT
We've had this initially, but it introduces an ambiguity in the grammar, because the parser cannot decide whether it is an optional extension name or an optional return type of a following function.
Comment 2 Jan Koehnlein CLA 2011-07-06 06:06:15 EDT
Oops, forget that last comment, we now have a def keyword.
Comment 3 Sven Efftinge CLA 2011-07-06 07:08:38 EDT
It would be ambiguous whether the following is two or one field:

'''
Foo Bar
'''

If we make it dependent on the existence of the 'extension' keyword it might work.
We'll have to check what kind of effects this has on content assist and error recovery.
Comment 4 Sebastian Zarnekow CLA 2011-08-29 09:37:32 EDT
Pushed to master.
Comment 5 Karsten Thoms CLA 2017-09-19 18:03:00 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 6 Karsten Thoms CLA 2017-09-19 18:13:12 EDT
Closing all bugs that were set to RESOLVED before Neon.0