[ 
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. Oak now requires 
Java 17, 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)).

Proposal:
* Deprecate org.apache.jackrabbit.oak.commons.Buffer (no other change to 
oak-commons).
* Replace all its uses with java.nio.ByteBuffer in oak-segment-tar, 
oak-segment-remote, oak-segment-aws, oak-segment-azure and oak-upgrade, 
including the segment persistence SPI (SegmentArchiveReader, 
SegmentArchiveWriter, PersistentCache) and the oak-segment-remote hooks.
* The affected exported packages are all @Internal 
(segment.remote.persistentcache via OAK-12510), so they get major version bumps 
without a deprecation period.

  was:
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.


> 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. Oak now 
> requires Java 17, 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)).
> Proposal:
> * Deprecate org.apache.jackrabbit.oak.commons.Buffer (no other change to 
> oak-commons).
> * Replace all its uses with java.nio.ByteBuffer in oak-segment-tar, 
> oak-segment-remote, oak-segment-aws, oak-segment-azure and oak-upgrade, 
> including the segment persistence SPI (SegmentArchiveReader, 
> SegmentArchiveWriter, PersistentCache) and the oak-segment-remote hooks.
> * The affected exported packages are all @Internal 
> (segment.remote.persistentcache via OAK-12510), so they get major version 
> bumps without a deprecation period.



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

Reply via email to