JDK-8201503 : filterArguments runs multiple filters in the wrong order
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 10-pool
  • Submitted: 2018-04-12
  • Updated: 2018-04-18
  • Resolved: 2018-04-13
Related Reports
CSR :  
Relates :  
Description
Summary
-------

Fix the implementation of `MethodHandles.filterArguments` to conform to the specification (the pseudocode). 

Problem
-------

`MethodHandles.filterArguments` pseudocode specifies that the filter method handles are invoked in argument order from left to right.  However, the implementation invoked the filter method handles from right to left. This behaviour is observable if the filter arguments retain some global state that affects the results, likely an edge case. However that edge case is exposed for string concatenation using invokedynamic where the `toString` implementation has side-effects that affect the `String` result (see JDK-8200118).

Solution
--------

Fix the implementation to invoke filter method handles in argument order from left to right. 

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

This is a behavioral change. There are no specification changes for JDK 10. Specification is clarified in JDK 11 CSR (JDK-8201371).
Comments
Moving to Approved.
13-04-2018

[~shade] yes, press "Finalize"!
13-04-2018

[~mchung], did so. I should now press "Finalize", right?
13-04-2018

[~shade] The javadoc change is not included in the backport. So please update the specification section to mention the behavorial change rather than the javadoc change.
13-04-2018

For the update release, I recommend at least one of Paul and Alan review the request and that the javadoc change be omitted.
13-04-2018