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

Improve the exception message thrown by VarHandle of unsupported operation

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 11
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:
      None

      Description

      When VarHandle::set is called on a final field, the current implementation throws UOE with no exception message.

      java.lang.UnsupportedOperationException
      at java.base/java.lang.invoke.VarForm.getMemberName(VarForm.java:92)
      at java.base/java.lang.invoke.VarHandle.getMethodHandleUncached(VarHandle.java:1986)
      at java.base/java.lang.invoke.VarHandle.getMethodHandle(VarHandle.java:1979)
      at java.base/java.lang.invoke.Invokers.checkVarHandleExactType(Invokers.java:465)
      at VarHandles.setter(VarHandles.java:84)
      at VarHandles.main(VarHandles.java:56)

      Also Remi reports this: https://mail.openjdk.java.net/pipermail/core-libs-dev/2020-December/072500.html

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated: