JDK-8199875 : Require first parameter type of a condy bootstrap to be Lookup
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 11
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2018-03-20
  • Updated: 2018-07-02
  • Resolved: 2018-04-11
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b09Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Description
CONSTANT_Dynamic resolution occurs by invoking a bootstrap method via 'invokeWithArguments', passing an array of arguments. The first three arguments are invocation metadata���a Lookup, a name, and a Class. If the arguments can't be cast to the bootstrap method's input types, the invocation fails. 

To facilitate more flexible bootstrap method calling conventions in the future, we'd like to require that the first parameter has type MethodHandles.Lookup. If a bootstrap does not conform, an error will occur, with the possibility of using a different calling convention in the future. 

This change rejects bootstraps like the following, which can currently be invoked without error: 
static Foo bootstrap(Object lookup, String name, Class<?> type) 
static Foo bootstrap(Object... args) 

For compatibility, no change is proposed to the resolution behavior for invokedynamic bootstraps.
Comments
changeset in amber: http://hg.openjdk.java.net/amber/amber/rev/3623e1e0e5d8
22-03-2018