Bug 499197 - [1.8] Wildcard type inference for method reference fails
Summary: [1.8] Wildcard type inference for method reference fails
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: helpwanted
Depends on:
Blocks:
 
Reported: 2016-08-04 19:59 EDT by Steven Schlansker CLA
Modified: 2023-06-07 16:50 EDT (History)
2 users (show)

See Also:


Attachments
self-contained compilable source code (1.11 KB, text/plain)
2016-08-05 07:25 EDT, Stephan Herrmann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Schlansker CLA 2016-08-04 19:59:00 EDT
This code compiles with javac 1.8.0_101 and IntelliJ but not with Eclipse 4.6.0:

https://gist.github.com/stevenschlansker/1a85215249708e325e0baa42e9d7d8bb

It's unclear to me exactly how enum-like recursive type declarations (Config<C extends Config<C>) should interact with wildcards (Entry<? extends Config<?>>), but the differing behavior from javac is inconvenient...
Comment 1 Stephan Herrmann CLA 2016-08-05 07:25:03 EDT
Created attachment 263478 [details]
self-contained compilable source code

Adding the full source code including necessary imports.

I agree that differences between compilers are "inconvenient".

Unfortunately, type inference involving wildcards and captures is one of the hardest to get right, with a prominent javac bug [1] still unresolved 3 years later.

I also tried javac from a Java 9 early access build, because they have some improvements in this area, but still not the same result as ecj.

This doesn't rule out a bug in ecj, but just the analysis for each of these cases is a huge effort, so please don't hold your breath waiting for a fix.


[1] https://bugs.openjdk.java.net/browse/JDK-8016207
Comment 2 Manoj N Palat CLA 2018-05-17 03:25:05 EDT
bulk move out of 4.8
Comment 3 Manoj N Palat CLA 2018-08-16 00:07:31 EDT
Bulk move out of 4.9
Comment 4 Eclipse Genie CLA 2023-06-07 16:50:19 EDT
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.