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

Paul Sandoz psandoz at openjdk.java.net
Fri Oct 2 17:44:48 UTC 2020


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.

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

Commit messages:
 - 8253944: Certain method references to VarHandle methods should fail

Changes: https://git.openjdk.java.net/jdk/pull/487/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=487&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8253944
  Stats: 158 lines in 5 files changed: 125 ins; 13 del; 20 mod
  Patch: https://git.openjdk.java.net/jdk/pull/487.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/487/head:pull/487

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


More information about the compiler-dev mailing list