RFR: 8343110: Add getChars(int, int, char[], int) to CharSequence and CharBuffer

Chen Liang liach at openjdk.org
Mon Mar 17 02:23:53 UTC 2025


On Sat, 15 Mar 2025 23:30:21 GMT, Markus KARG <duke at openjdk.org> wrote:

> Some good reason to *not* adopt my proposal?

I am still afraid of such a pattern in the future like:

CharSequence cs = ...
if (cs.getClass().getModule() == Object.class.getModule()) {
    // or cs.getClass().getClassLoader() == null
    cs.getChars(...);
} else {
    // damn, can't trust an arbitrary char sequence!
    char[] intermediate = ...
    cs.getChars(...);
    // copy from intermediate etc.
}

-------------

PR Comment: https://git.openjdk.org/jdk/pull/21730#issuecomment-2727862188


More information about the core-libs-dev mailing list