(reflect) Clarify private final field mutability

XMLWordPrintable

    • b138
    • generic
    • generic
    • Not verified

      Bill Pugh writes:

      The documentation for Field is unclear. It could easily be interpreted as
      through setAccessible applies to the field, not the Field object:

      > If the underlying field is final, the method throws an IllegalAccessException unless setAccessible(true) has succeeded for this field and this field is non-static.

      I think th should be changed to something like.

      > If the underlying field is final, the method throws an IllegalAccessException unless isAccessible(true) is true for this Field object and this Field object represents a non-static field.


      In general, whenever the JavaDoc talks about whether setAccessible has been called for a field,
      it should be referring to whether isAccessible returns true for the <code>Field</code> object. Same for
      other subtypes of AccessibleObject.

            Assignee:
            Joe Darcy
            Reporter:
            Martin Buchholz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: