8246282: [REDO] JDK-8245121 (bf) XBuffer.put(Xbuffer src) can give unexpected result when storage overlaps

Brian Burkhalter brian.burkhalter at oracle.com
Thu Jun 4 15:10:56 UTC 2020


> On Jun 4, 2020, at 7:08 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> 
> On 03/06/2020 01:48, Brian Burkhalter wrote:
>> :
>> 
>> I added a char-only package scope method isAddressable() which returns true by default with StringCharBuffer overriding it to return false.
>> 
> Looks good although I think the phrase "simply addressable" could confuse future maintainers. Maybe drop "simply" and expand the comment to say that it is false for StringCharBuffer that wraps a char sequence.

For example:

--- a/src/java.base/share/classes/java/nio/X-Buffer.java.template
+++ b/src/java.base/share/classes/java/nio/X-Buffer.java.template
@@ -1499,10 +1499,10 @@
 
 #if[char]
     /**
-     * Tells whether this buffer has simply addressable memory, e.g.,
-     * a Java array or a native address.  This method returns {@code true}.
-     * Subclasses which do not have simply addressable memory should override
-     * this method to return {@code false}.
+     * Tells whether this buffer has addressable memory, e.g., a Java array or
+     * a native address.  This method returns {@code true}.  Subclasses such as
+     * {@code StringCharBuffer}, which wraps a {@code CharSequence}, should
+     * override this method to return {@code false}.
      *
      * @return {@code true} if, and only, this buffer has addressable memory
      */

Thanks,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20200604/c53a9b09/attachment.htm>


More information about the nio-dev mailing list