RFR 8191416: (bf) DirectByteBuffer extends MappedByteBuffer, confuses instanceof tests
Brian Burkhalter
brian.burkhalter at oracle.com
Tue Feb 6 19:41:01 UTC 2018
On Feb 6, 2018, at 8:41 AM, Alan Bateman <Alan.Bateman at oracle.com> wrote:
> On 06/02/2018 01:17, Brian Burkhalter wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8191416
>> http://cr.openjdk.java.net/~bpb/8191416/webrev.00/
>>
>> As suggested in the issue description, change force(), load(), and isLoaded() to be no-ops when there is no backing file instead of throwing UnsupportedOperationException.
>>
> It's an undocumented implementation detail that a direct buffer is a MappedByteBuffer. This dates back to the original implementation, is complicated to change, and maybe we should put the effort re-visiting it.
So skip this mitigation or go ahead with it and follow with a more thorough re-visiting under a separate issue?
> I read this patch as a short term mitigation for those that test if a buffer is a MappedByteBuffer so they can call force. I guess it's okay although I do wonder if this mitigation should be limited to force and don't touch loaded/isLoaded.
These seem harmless however.
> Minor comment is that the other methods uses "mapping" in the name so maybe hasFileMapping might be better.
I’ll change it.
On Feb 6, 2018, at 8:42 AM, Roger Riggs <Roger.Riggs at Oracle.com> wrote:
> (I'm not sure I would describe the behavior as a no-op; since I think they do achieve the invariant as defined).
OK can change the description.
Thanks,
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180206/4f6e90f6/attachment.html>
More information about the nio-dev
mailing list