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

Bug 352844

Summary: [Xtend] Auto-(Un)Boxing feature of Java 5 not supported by Function types with void parameters (in generated code)
Product: [Modeling] TMF Reporter: Sebastian Zarnekow <sebastian.zarnekow>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 Flags: sebastian.zarnekow: indigo+
Version: 2.0.0   
Target Milestone: SR1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Sebastian Zarnekow CLA 2011-07-22 05:59:54 EDT
Xtend code (compiles):

def generate(DomainModel d, IFileSystemAccess fsa) {
// TODO: Use spreading operator: d.elements*.(e | e.generate(fsa))
d.elements.iter(e | e.generate(fsa)) // e.generate returns void
}

def <T,R> iter(java.util.List<T> list, (T)=>R predicate) {
for(element : list) { predicate.apply(element); }
}

Generated code (does not compile):
...
// e | e.generate(fsa)
final Function1<AbstractElement, void > _function = new Function1<AbstractElement, void >() {
...

Workaround:
d.elements.iter(e | e.generate(fsa) as Void)

one would expect that Xtend code does not compile if Java code does not compile
Comment 1 Sebastian Zarnekow CLA 2011-07-22 06:29:00 EDT
Pushed to master.
Comment 2 Karsten Thoms CLA 2017-09-19 16:53:48 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 3 Karsten Thoms CLA 2017-09-19 17:04:38 EDT
Closing all bugs that were set to RESOLVED before Neon.0