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

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Tue Dec 17 21:21:14 UTC 2019


On 17/12/2019 18:22, B. Blaser wrote:
> So, I moved it the specification component and assigned it to Dan.
Thanks!
>
> 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.

I'm afraid it can't be that simple - if you have multiple, non-generic 
methods which can be potential target of a method reference expression, 
which one would you use in order to type-check against the functional 
interface target?

Maurizio

>   All the rest would
> remain unchanged (all lambda expressions and method references with
> stuck variables).


More information about the compiler-dev mailing list