Community
Participate
Working Groups
Created attachment 266444 [details] A class which cannot be compiled by Eclipse, but no error with javac 1.8 Eclipse gives an error in line 16: The method print(Long) in the type Test is not applicable for the arguments (Object) Interesting that when lambda is replaced with method reference, the error goes away.
I can confirm this happens in the latest I build - I20170124-0800. I am sorry, I tried finding similar existing bugs but not sure which ones. Stephan, could you take a look?
(In reply to Jay Arthanareeswaran from comment #1) > I can confirm this happens in the latest I build - I20170124-0800. > > I am sorry, I tried finding similar existing bugs but not sure which ones. > > Stephan, could you take a look? sure The program is rejected by all Java-8 enabled versions of ecj.
The workaround is: say new Wrapper<Integer,Long>() instead of new Wrapper<>(). Looks like inference cannot properly propagate from inner inference to outer diamond inference. This is supported by the following variant (accepted by ecj, too): //--- ... ints.map(Wrapper.create(intNum -> converter.convert(intNum))).forEach(longNum -> print(longNum)); ... static <T,R> Wrapper<T,R> create(Function <T,R> function) { return new Wrapper<>(function); } //--- i.e., replacing the diamond with a static generic factory method avoids the problem, too. Pushing information from inner inference to outer is a thorny issue, not for 4.12.
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.