RFR: 8253944: Certain method references to VarHandle methods should fail

Maurizio Cimadamore mcimadamore at openjdk.java.net
Fri Oct 2 20:28:38 UTC 2020


On Fri, 2 Oct 2020 17:38:19 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

> A regression was introduced in javac when processing method references to signature polymorphic methods whose return
> type is not polymorphic.
> It is possible to successfully target type a method reference for a VarHandle sig-poly method to a functional interface
> whose methods return type is incompatible with the VarHandle method. This results in a runtime linkage error rather
> than a source compile time error.  See the following email thread for more details:
> 
> https://mail.openjdk.java.net/pipermail/compiler-dev/2020-October/015088.html
> 
> The fix is to "patch-back" the method's return type if it is not polymorphic. As a result it was possible to simplify
> the inference logic and keep it focused more on inference.

Looks good!

-------------

Marked as reviewed by mcimadamore (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/487


More information about the compiler-dev mailing list