Uploaded image for project: 'Harmony'
  1. Harmony
  2. HARMONY-4927

[drlvm][kernel] cannot modify final instance fields via reflection

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • None
    • DRLVM
    • None
    • Novice

    Description

      Accidentally I spotted the following minor misbehavior of reflection in DRLVM, it does not allow to modify final instance fields. The 1.5 spec of j.l.reflect.Field.set() reads:
      "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. Setting a final field in this way is meaningful only during deserialization or reconstruction of instances of classes with blank final fields, before they are made available for access by other parts of a program. Use in any other context may have unpredictable effects, including cases in which other parts of a program continue to use the original value of this field."

      BTW, I'd suggest to add a testcase for this to kernel tests rather than to regression suite.

      Attachments

        Issue Links

          Activity

            People

              varlax Alexey Varlamov
              varlax Alexey Varlamov
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: