-
CSR
-
Resolution: Approved
-
P4
-
None
-
source, binary
-
minimal
-
Changes to a preview API have minimal risk.
-
Java API
-
SE
Summary
Remove the BufWriter::asByteBuffer
public API.
Problem
BufWriter::asByteBuffer
exposes the backing array of the BufWriter in an inconsistent way: without resizing, it reflects the changes to the array, but once the backing array has been resized, the buffer is no longer up-to-date.
Solution
Remove the BufWriter::asByteBuffer
API. Users who wish to access the content of a BufWriter can use BufWriter::copyTo(byte[], int)
.
Specification
--- a/src/java.base/share/classes/java/lang/classfile/BufWriter.java
+++ b/src/java.base/share/classes/java/lang/classfile/BufWriter.java
@@ -192,11 +191,6 @@ public sealed interface BufWriter
*/
int size();
- /**
- * {@return a {@link java.nio.ByteBuffer ByteBuffer} view of the bytes in the buffer}
- */
- ByteBuffer asByteBuffer();
-
/**
* Copy the contents of the buffer into a byte array.
*
- csr of
-
JDK-8311175 Move BufWriter::asByteBuffer to BufWriterImpl
-
- Closed
-