Community
Participate
Working Groups
Created attachment 274045 [details] Examples Found a strange behaviour where the eclipse compiler fails to compile a file, that compiles without any problems with Oracle JDK's javac. Seems to be a problem with type inference and bounded generics. Playing around with the position of the type parameters, I was able to make eclipse compile the file. But now javac fails! I added a minimalized example showing the problem (maybe it could be minimized more). Example 1 compiles in Eclipse but not with javac. (Error: incompatible types: cannot infer type-variable(s) T; this.action(a.get().entrySet(), this::handleEntry);) Example 2 compiles with javac but not with Eclipse. (Error: The type Test does not define handleEntry(List<Test.A>, Map.Entry<String,List<capture#1-of ? extends Test.A>>) that is applicable here) Note that the only difference between these two examples is the handleEntry function's signature. Tested with Java 8 and 10 in Eclipse Oxygen 4.7.3a.
Thanks for the examples. Figuring out, which compiler is right or wrong in this kind of situations can be quite a hard nut to crack. So please don't hold your breath waiting for a change. From a quick glance it seems that ecj is able to unify the type variable T with a wildcard, but it cannot unify two distinct wildcards. At this level I can find no fault at ecj's behavior, but please take this statement with a grain of salt.
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.