JDK-8219318 (???): inferred type does not conform to upper bound(s) when collecting to a HashMap

B. Blaser bsrbnd at gmail.com
Tue Dec 17 18:22:36 UTC 2019


On Tue, 17 Dec 2019 at 15:09, Maurizio Cimadamore
<maurizio.cimadamore at oracle.com> wrote:
>
> On 17/12/2019 12:32, B. Blaser wrote:
> >
> > But as I don't see much enthusiasm in going in this direction, I'll
> > close this issue as you suggested.
>
> As I said above, I think the fact that we have a discrepancy between
> assignment context and invocation context, and one that is probably
> caused by incorporation rules not being strong enough when the overload
> target contains wildcards, is something that can be submitted for
> evaluation to the spec team. While we're not willing to make the
> overload and invocation inference process fully symmetric (for the
> reasons above), adding extra incorporation rules to help in cases like
> these doesn't seem (too) bad.

So, I moved it the specification component and assigned it to Dan.

Note that the fix I suggested isn't fully symmetric neither; the
overload inference would only includes method references that don't
have stuck variables, see [1]. The only thing that would have to
change in the JLS is that inexact method references with no stuck
variables would be pertinent to applicability. All the rest would
remain unchanged (all lambda expressions and method references with
stuck variables).

Cheers,
Bernard

[1] http://hg.openjdk.java.net/jdk/jdk/file/cec148db7b55/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java#l1145


More information about the compiler-dev mailing list