[ 
https://issues.apache.org/jira/browse/OAK-12486?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lucas Weitzendorf updated OAK-12486:
------------------------------------
    Description: 
org.apache.jackrabbit.oak.commons.Buffer wraps java.nio.ByteBuffer to avoid 
NoSuchMethodError when code compiled on Java 9+ ran on Java 8 (covariant return 
types of position/limit/flip etc.). Oak now requires Java 11, so that reason no 
longer applies.

Meanwhile the wrapper exposes only a restricted subset of the ByteBuffer API, 
which is tedious to keep up to date and prevents callers from using more 
efficient/concise methods (e.g. absolute bulk get/put, slice(int,int), 
mismatch).

Proposal:
* Deprecate org.apache.jackrabbit.oak.commons.Buffer (add 
wrap(ByteBuffer)/toByteBuffer() bridges).
* Replace its internal uses with java.nio.ByteBuffer in oak-segment-tar, 
oak-segment-remote, oak-segment-aws, oak-segment-azure and oak-upgrade.
* Keep the public segment persistence SPI (SegmentArchiveReader, 
SegmentArchiveWriter, PersistentCache) signatures unchanged for now to avoid a 
breaking change; convert at the boundary.

  was:
org.apache.jackrabbit.oak.commons.Buffer is a thin wrapper around 
java.nio.ByteBuffer exposing a restricted subset of its API. Since Oak now 
targets Java 11, the wrapper adds little value and prevents callers from using 
more efficient/concise ByteBuffer methods (e.g. absolute bulk get/put, 
slice(int,int), mismatch).

Proposal:
* Deprecate org.apache.jackrabbit.oak.commons.Buffer.
* Replace its internal uses with java.nio.ByteBuffer in oak-segment-tar, 
oak-segment-remote, oak-segment-aws, oak-segment-azure and oak-upgrade.
* Keep the public segment persistence SPI (SegmentArchiveReader, 
SegmentArchiveWriter, PersistentCache) signatures unchanged for now to avoid a 
breaking change; convert at the boundary.


> Deprecate oak-commons Buffer and replace internal uses with ByteBuffer
> ----------------------------------------------------------------------
>
>                 Key: OAK-12486
>                 URL: https://issues.apache.org/jira/browse/OAK-12486
>             Project: Jackrabbit Oak
>          Issue Type: Improvement
>          Components: segment-tar
>            Reporter: Lucas Weitzendorf
>            Priority: Major
>
> org.apache.jackrabbit.oak.commons.Buffer wraps java.nio.ByteBuffer to avoid 
> NoSuchMethodError when code compiled on Java 9+ ran on Java 8 (covariant 
> return types of position/limit/flip etc.). Oak now requires Java 11, so that 
> reason no longer applies.
> Meanwhile the wrapper exposes only a restricted subset of the ByteBuffer API, 
> which is tedious to keep up to date and prevents callers from using more 
> efficient/concise methods (e.g. absolute bulk get/put, slice(int,int), 
> mismatch).
> Proposal:
> * Deprecate org.apache.jackrabbit.oak.commons.Buffer (add 
> wrap(ByteBuffer)/toByteBuffer() bridges).
> * Replace its internal uses with java.nio.ByteBuffer in oak-segment-tar, 
> oak-segment-remote, oak-segment-aws, oak-segment-azure and oak-upgrade.
> * Keep the public segment persistence SPI (SegmentArchiveReader, 
> SegmentArchiveWriter, PersistentCache) signatures unchanged for now to avoid 
> a breaking change; convert at the boundary.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to