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

com.sun.jdi.ObjectReference::setValue should throw InvalidTypeException for non-modifiable final fields

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Not an Issue
    • Affects Version/s: 15
    • Fix Version/s: None
    • Component/s: core-svc
    • Labels:
      None

      Description

      Static final fields are non-modifiable via java.lang.reflect.Field::set.
      In JDI, ObjectReference::setValue throws IllegalArgumentException if the given Field is static final field (see ReferenceTypeImpl::validateFieldSet)

      Non-static final fields in a hidden class are non-modifiable via java.lang.reflect.Field::set.
      ObjectReference::setValue should respect the spec of Field::set that ObjectReference::setValue can change the value of a given Field if it is modifiable.

      It's unclear if the spec of ObjectReference::setValue should clarifiy the behavior regardless of the value of the accessible flag of the given Field.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              amenkov Alex Menkov
              Reporter:
              mchung Mandy Chung
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: