Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 364953 - [Xtend] allow invoking static methods in explicit constructor calls
Summary: [Xtend] allow invoking static methods in explicit constructor calls
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: unspecified   Edit
Hardware: Macintosh Mac OS X
: P3 major (vote)
Target Milestone: M4   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-28 09:03 EST by Moritz Eysholdt CLA
Modified: 2017-09-19 17:58 EDT (History)
1 user (show)

See Also:
sebastian.zarnekow: juno+


Attachments

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