Represent jchar as a proper C/C++ UTF-16 character

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • tbd
    • Affects Version/s: 21
    • Component/s: hotspot

      C and C++ have had a language type which is properly meant to encode UTF-16 characters for a long time by this point: char16_t. Its underlying type is an unsigned short, making it entirely backwards compatible with the Java Native Interface's requirement that a jchar is an unsigned 16 bit type. With these types underlying the jchar typedef special support for jchar can be used within native C and C++ code in the JDK, as well as solving certain casting issues with native APIs, such as on Windows, all in a backwards compatible way

      Caveat: Although all the platforms we support do have an unsigned 16 bit number as the underlying type of char16_t, a new platform we may add support for in the future might technically not do so. An assert can be very easily added in such a case

            Assignee:
            David Holmes
            Reporter:
            Julian Waters
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: