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

Bug 364953

Summary: [Xtend] allow invoking static methods in explicit constructor calls
Product: [Modeling] TMF Reporter: Moritz Eysholdt <moritz.eysholdt>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P3 CC: sebastian.zarnekow
Version: unspecifiedFlags: sebastian.zarnekow: juno+
Target Milestone: M4   
Hardware: Macintosh   
OS: Mac OS X   
Whiteboard:

Description Moritz Eysholdt CLA 2011-11-28 09:03:29 EST
The example

----
class bar {
	def static foo(int i) { 
		i + 1
	}
	
	new(int i) {
	}
	
	new() {
		this(foo(1))
	}
}
---

raises error "Cannot refer to a method while explicitly invoking a constructor" under "foo(1)".

Expected behavior: no error message, since this can directly be mapped to Java.

The same should apply for "super()":
---
class foo extends bar {
	new() {
 		super(bar::foo( 42))
 	}
}
---
Comment 1 Sebastian Zarnekow CLA 2011-11-28 09:08:18 EST
See testcase with wrong expectation:

Xtend2ValidationTest.testConstructorArgumentIsValid_04()
Comment 2 Sebastian Zarnekow CLA 2011-11-28 10:43:44 EST
Pushed to master.
Comment 3 Karsten Thoms CLA 2017-09-19 17:47:35 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 4 Karsten Thoms CLA 2017-09-19 17:58:44 EDT
Closing all bugs that were set to RESOLVED before Neon.0