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

Improve the exception message thrown by VarHandle of unsupported operation

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P3 P3
    • 22
    • 11, 17, 21, 22
    • core-libs

      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

            mchung Mandy Chung
            mchung Mandy Chung
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: