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

Require first parameter type of a condy bootstrap to be Lookup

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 11
    • Fix Version/s: 11
    • Component/s: core-libs
    • Labels:
      None

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                psandoz Paul Sandoz
                Reporter:
                psandoz Paul Sandoz
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: