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

Improve the exception message thrown by VarHandle of unsupported operation

    Details

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

      Description

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

      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)

        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: