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

Remove ResourceScope-less overload from API

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: repo-panama
    • Fix Version/s: None
    • Component/s: tools

      Description

      Overload methods which do not take a ResourceScope (hence, they use an implicit scope instead) create some opportunities for bugs to hide; consider;

      try (ResourceScope scope = ResourceScope.ofConfined()) {
          MemorySegment str = CLinker.toCString("hello");
      }

      It is really hard for humans to see that the C string allocation does not use the outer scope (as the TWR block is visually very imposing, whereas implicit scope here is denoted by "absence").

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mcimadamore Maurizio Cimadamore
              Reporter:
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: