RFR 8188144: regression in method reference type-checking
vicente.romero at oracle.com
Fri Sep 29 17:54:12 UTC 2017
nit: why static methods? not strong about this but we usually favor
instance over static methods
On 09/29/2017 12:42 PM, Maurizio Cimadamore wrote:
> here's a patch for a regression in method reference type checking:
> JLS 15.13.1 defines the process for resolving a method reference -
> this is a two step process, where two searches are performed. It is
> sometimes possible for both searches to produce a result - when that
> happens, there are a bunch of rules which tell us what search wins:
> " the first search produces a most specific method that is |static|,
> and the set of applicable methods produced by the second search
> contains no non-|static| methods, then the compile-time declaration is
> the most specified method of the first search"
> And again:
> "Otherwise, if the set of applicable methods produced by the first
> search contains no |static| methods, and the second search produces a
> most specific method that is non-|static|, then the compile-time
> declaration is the most specific method of the second search."
> Javac has been rectified to correctly implement this logic as part of:
> However, in the degenerate case where both searches return _the same_
> method, the rectified logic doesn't work. This is caused by the fact
> that we use the resolved symbol to 'infer' which search (first or
> second?) gave us the desired result. Note that it is important for
> javac to know which search produced the result as that will affect
> code generation (is this a bound or an unbound method reference?).
> Since we already had all the desired information in the class called
> ReferenceLookupResult - introduced as part of JDK-8068995, I have
> tweaked the ReferenceChooser::result signature to return one of those
> guys instead of a plain Symbol - this allows us to reconstruct the
> correct picture before returning control to Attr.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the compiler-dev