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

Lookup argument for StringConcatFactory.makeConcat & makeConcatWithConstants cannot have privileges less than PRIVATE

XMLWordPrintable

      The APIs StringConcatFactory.makeConcat & makeConcatWithConstants when passed with MHs.publicLookup() errors out with StringConcatException. The documentation doesnt unambiguously mention restrictions on lookup param.

      StringConcatFactory.makeConcat(MethodHandles.publicLookup(), "name", concatType); -> generates StringConcatException
      whereas
      StringConcatFactory.makeConcat(MethodHandles.lookup(), "name", concatType); -> works fine.

      As per documentation:
      "lookup - Represents a lookup context with the accessibility privileges of the caller" -> accessibility privileges can be spelt out more precisely. As in, of the PUBLIC/MODULE/PACKAGE/PRIVATE/PROTECTED privileges, what privileges the caller should hold to use the API.

            psandoz Paul Sandoz
            pgundarlahal Prashanthram Gundarlahally
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: