Community
Participate
Working Groups
Following code ends up with compilation errors: //---------------- Future<Runnable> fut = executorService.submit( () -> { // do some calculations here and then // return a lambda that will do something after return () -> { try { // do after job here } catch (Exception e) { String msg = "some error message"; logger.warn(msg, e); } }; }); //--------------- On first lambda (Callable) I got the error message: The method submit(Callable<T>) in the type ExecutorService is not applicable for the arguments (() -> {}) On second lambda (Runnable) is compilation error: The target type of this expression must be a functional interface
In the past we learned that JLS alone doesn't always cope well with nested lambdas, and additional advice from javac developers was needed to improve ecj in this regard. Will be a hard nut to crack. Workaround: pass an explicit type argument: ... executorService.<Runnable>submit( ...
bulk move out of 4.8
Bulk move out of 4.9
Works for me in 2019-09 R (4.13.0) • JDT 3.18.100.v20190916-1045 • tried ecj 1.8, 12. Stubbed out test case follows: //---------------- import java.util.concurrent.Callable; import java.util.concurrent.Future; public class _520799 { class StubExecutorService { public <T> Future<T> submit(Callable<T> task) { return null; } } void test() { StubExecutorService es = new StubExecutorService(); Future<Runnable> fut = es.submit(() -> { // do work here return () -> { // called after complete }; }); } } //----------------
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.