RFR 8195598: Reference to overloaded method is ambiguous with 3 methods but works with 2

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Wed Jan 17 15:31:19 UTC 2018


Hi,
this is a fix related to the most specific selection between functional 
interfaces. The most specific functional interface analysis needs access 
to the speculative tree determined during overload resolution; such info 
is only available if a given argument is pertinent to applicability 
w.r.t. a given method.

Unfortunately, the fix for JDK-8154180 
<https://bugs.openjdk.java.net/browse/JDK-8154180> introduced a single 
shared flag called 'pertinentToApplicability' which is unset whenever a 
given argument is found to be stuck. Now, the issue here is that the 
flag should not be shared across all possible targets an actual is 
checked against. That is, for each target there should be a separate 
flag. Since the flag is shared, a single target which makes the argument 
stuck is sufficient to make the most specific process fail, even if 
other applicable targets were found in the process (depending on the order).

The solution is to use a set to keep track of the targets for which the 
argument was NOT pertinent to applicability (e.g. stuck). This brings 
the compiler back in sync with the spec.

Webrev:

http://cr.openjdk.java.net/~mcimadamore/8195598/

Cheers
Maurizio

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20180117/5b6dcd64/attachment.html>


More information about the compiler-dev mailing list