Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8216558 Lookup.unreflectSetter(Field) fails to throw IllegalAccessException for static final field
  3. JDK-8221613

Release Note: Lookup.unreflectSetter(Field) Now Throws IllegalAccessException for Static Final Fields

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Closed
    • Priority: P4
    • Resolution: Delivered
    • Affects Version/s: 13
    • Fix Version/s: 13
    • Component/s: core-libs
    • Labels:

      Description

      `java.lang.invoke.MethodHandles.Lookup::unreflectSetter` returns a `MethodHandle` giving write access to the given `Field` object. A `Field` object for a static final field does not have write access even if its accessible flag is true (i.e. `Field.setAccessibe(true)` has been called). In JDK 13, `Lookup::unreflectSetter` is fixed to throw `IllegalAccessException` if the given `Field` object is a static final field.

        Attachments

          Activity

            People

            Assignee:
            afarley Adam Farley
            Reporter:
            afarley Adam Farley
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: