JDK-8201268 : Require first parameter type of a condy bootstrap to be Lookup
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Priority: P3
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 11
  • Submitted: 2018-04-06
  • Updated: 2018-04-10
  • Resolved: 2018-04-10
Related Reports
CSR :  
Description
Summary
-------

Constrain constant dynamic bootstrap methods to methods whose first parameter type is `MethodHandles.Lookup`.

Problem
-------

It's not easy to use existing methods as constant dynamic bootstrap methods. A level of indirection is required, either explicitly or via use of the bootstrap method `ConstantBootstraps.invoke` to drop the first three arguments of lookup, name, and type. While this change does not address that problem it will ensure the problem can be addressed in a future release without affecting compatibility of existing constant dynamic bootstrap methods.

Solution
--------

Constrain constant dynamic bootstrap methods to methods whose first parameter type is `MethodHandles.Lookup`. 

Specification
-------------

The VM specification will require updating, tracked by JDK-8199051. The `java/lang/invoke/package-html.java` has been updated (see attached).


Comments
I've spoken with Paul in person about this request. It was initially surprising to me that the specification of ConstantBootstraps.java wasn't updated as part of this request. As discussed, if a "@jvms" javadoc tag existing, analagous to the "@jls" tag, such constraints could be more clearly communicated. Moving to Approved.
10-04-2018