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

Exceptions thrown by cleanup actions should be handled correctly

    XMLWordPrintable

Details

    Description

      MemorySegment::reinterpret allows developers to specify a cleanup action - an action that should be executed when the arena associated with the reinterpreted segment is closed.

      The custom cleanup action might throw some exceptions. Unfortunately, in the current API, Arena::close is only specified to throw IllegalStateException, UnsupportedOperationException or WrongThreadException, meaning that any exception thrown by the custom cleanup action would effectively violate the javadoc.

      It would be better for cleanup action exceptions to be wrapped to some other runtime exception which is then specified to be part of the contract when calling Arena::close.

      Attachments

        Issue Links

          Activity

            People

              mcimadamore Maurizio Cimadamore
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: