RFR: 8352536: Add overloads to parse and build class files from/to ByteBuffer and MemorySegment
Chen Liang
liach at openjdk.org
Thu Mar 20 21:17:08 UTC 2025
On Thu, 20 Mar 2025 19:49:33 GMT, David M. Lloyd <duke at openjdk.org> wrote:
> Provide method overloads to the ClassFile interface of the java.lang.classfile API which allow parsing of classes found in byte buffers and memory segments, as well as allowing built class files to be output to these types.
src/java.base/share/classes/jdk/internal/classfile/impl/ClassFileImpl.java line 159:
> 157: public ClassModel parse(final ByteBuffer bytes) {
> 158: // defensive copy
> 159: ByteBuffer dup = bytes.duplicate();
The array version has no defensive copy. Doesn't this defeat the performance goal of the API?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24139#discussion_r2006461120
More information about the core-libs-dev
mailing list