Community
Participate
Working Groups
package xtend.bugs import java.util.List class Bugs { def bug(List<Object> xs) { for(x : xs) { x?.foo } xs.forEach [ it?.foo ] } def void foo(Object o) { } } The generated java code is wrong: package xtend.bugs; import java.util.List; import org.eclipse.xtext.xbase.lib.IterableExtensions; import org.eclipse.xtext.xbase.lib.Procedures.Procedure1; @SuppressWarnings("all") public class Bugs { public void bug(final List<Object> xs) { for (final Object x : xs) { x==null?(void)null:this.foo(x); } final Procedure1<Object> _function = new Procedure1<Object>() { public void apply(final Object it) { it==null?(void)null:Bugs.this.foo(it); } }; IterableExtensions.<Object>forEach(xs, _function); } public void foo(final Object o) { } } 2 problems: - casting to 'void' is impossible - in this case the ternary operator can't be used, it should be replaced with an if statement
Already fixed in M6
Closing all bugs that were set to RESOLVED before Neon.0