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

Remove ResourceScope-less overload from API

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • None
    • repo-panama
    • tools

      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").

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

              Created:
              Updated:
              Resolved: