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

Require first parameter type of a condy bootstrap to be Lookup

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 11
    • 11
    • core-libs
    • None

      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.

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

              Created:
              Updated:
              Resolved: