RFR: 4833719: (bf) Views of MappedByteBuffers are not MappedByteBuffers, and cannot be forced [v6]
Brian Burkhalter
bpb at openjdk.java.net
Thu Mar 18 23:53:03 UTC 2021
> Please consider this proposal to add covariant overrides to `MappedByteBuffer` for the methods `compact()`, `duplicate()`, `slice()`, and `slice(int,int)`.
>
> The methods in question are added as abstract specifications in `MappedByteBuffer` and their implementations in `Direct-X-Buffer.java.template`. In `MappedByteBuffer` the `isSync()` method is changed to have package access, and a final package scope method `FileDescriptor fileDescriptor()` is added to return the associated file descriptor. Specification verbiage is added to the new covariant overrides, and the specification of `force()` is enhanced slightly. (The `unmapper()` method offers an alternative way to obtain the file descriptor and sync mode without the need for package access `fileDescriptor()` and `isSync()` methods.)
>
> In `Direct-X-Buffer.java.template` the constructor for duplicates and slices is modified to accept parameters for the file descriptor and sync mode for byte buffers. The uses of this constructor are correspondingly modified.
>
> A test is added to exercise the new methods. Verifying that `force()` is actually doing anything is not verified by this test but was checked manually. The change passes all other existing tests in tiers 1-3.
>
> Other methods for which it might be worth adding covariant overrides are the `get()` and `put()` methods which return a buffer, and, less interesting, the `put$Type$()` methods.
Brian Burkhalter has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
- Merge
- 4833719: corrections pursuant to JDK-8263742
- 4833719: Corrected faux pas in correcting faux pas
- 4833719: Corrected faux pas in the slice(int,int) spec
- 4833719: Remove @apiNotes and "A similar consideration"
- 4833719: (bf) Views of MappedByteBuffers are not MappedByteBuffers, and cannot be forced
-------------
Changes:
- all: https://git.openjdk.java.net/jdk/pull/2902/files
- new: https://git.openjdk.java.net/jdk/pull/2902/files/1e2eac09..3127ee0d
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=jdk&pr=2902&range=05
- incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=2902&range=04-05
Stats: 49334 lines in 1942 files changed: 34875 ins; 8292 del; 6167 mod
Patch: https://git.openjdk.java.net/jdk/pull/2902.diff
Fetch: git fetch https://git.openjdk.java.net/jdk pull/2902/head:pull/2902
PR: https://git.openjdk.java.net/jdk/pull/2902
More information about the nio-dev
mailing list