Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8201503

filterArguments runs multiple filters in the wrong order

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 10-pool
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Compatibility Risk Description:
      The likelyhood of existing method handle filter argument code relying on invocation in argument order from right to left is considered very small, since it is expected most filters will not be stateful in their results.
    • Scope:
      JDK

      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).

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                shade Aleksey Shipilev
                Reporter:
                darcy Joe Darcy
                Reviewed By:
                Mandy Chung, Paul Sandoz
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: