This is an automated email from the ASF dual-hosted git repository. leerho pushed a commit to branch prepare_3.0.3 in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git
commit db16ad99bbabb585f1efef4aa563acf977060d4a Author: Lee Rhodes <[email protected]> AuthorDate: Wed Feb 4 10:14:55 2026 -0800 minor fixes to permit running with Java 25 in restricted mode. --- .github/workflows/auto-jdk-matrix.yml | 6 +- .github/workflows/javadoc.yml | 104 ++++++++++++++++++--- .github/workflows/manual-coverage.yml | 6 +- .github/workflows/manual-os-matrix.yml | 6 +- .../org/apache/datasketches/memory/Buffer.java | 6 +- .../org/apache/datasketches/memory/Memory.java | 46 ++++----- .../datasketches/memory/MemoryRequestServer.java | 2 +- .../apache/datasketches/memory/MurmurHash3v2.java | 4 +- .../org/apache/datasketches/memory/Resource.java | 2 +- .../apache/datasketches/memory/WritableBuffer.java | 8 +- .../apache/datasketches/memory/WritableMemory.java | 78 ++++++++-------- .../datasketches/memory/internal/ResourceImpl.java | 8 +- .../apache/datasketches/memory/package-info.java | 3 +- 13 files changed, 178 insertions(+), 101 deletions(-) diff --git a/.github/workflows/auto-jdk-matrix.yml b/.github/workflows/auto-jdk-matrix.yml index 70a847c3..8d0ff117 100644 --- a/.github/workflows/auto-jdk-matrix.yml +++ b/.github/workflows/auto-jdk-matrix.yml @@ -19,19 +19,19 @@ jobs: steps: - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" - uses: actions/[email protected] + uses: actions/checkout@v4 with: persist-credentials: false - name: Cache local Maven repository - uses: actions/[email protected] + uses: actions/cache@v4 with: path: ~/.m2/repository key: build-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: build-${{ runner.os }}-maven- - name: Install Matrix JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: | 8 diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml index aeff17bf..a28042c3 100644 --- a/.github/workflows/javadoc.yml +++ b/.github/workflows/javadoc.yml @@ -1,23 +1,97 @@ -name: JavaDoc +name: Deploy Versioned Javadoc (Manual Trigger) + +# Select the target TAG where to run the workflow from. +# This TAG name becomes the subdirectory under branch gh-pages/docs/${TAG} +# where the javadocs will be copied to. +# The gh-pages/docs branch/folder must exist. on: - push: - branches: - - master workflow_dispatch: + inputs: + tag_ref: + description: 'Existing Git Tag to deploy (e.g., 1.0.0), default=99.0.0:' + required: true + default: '99.0.0' # unlikely to conflict if accidentally left blank. jobs: - javadoc: + build-and-deploy-javadoc: runs-on: ubuntu-latest + permissions: + contents: write + steps: - - name: Checkout - uses: actions/checkout@v3 - - name: Generate JavaDoc - run: mvn javadoc:javadoc - - name: Deploy JavaDoc - uses: JamesIves/github-pages-deploy-action@5dc1d5a192aeb5ab5b7d5a77b7d36aea4a7f5c92 + - name: Checkout Code at Specified Tag + uses: actions/checkout@v5 with: - token: ${{ secrets.GITHUB_TOKEN }} - folder: datasketches-memory-java8/target/site/apidocs - target-folder: docs/${{ github.ref_name }} - branch: gh-pages + ref: ${{ github.event.inputs.tag_ref }} # from manual trigger input + fetch-depth: 0 + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '8' + distribution: 'temurin' + cache: 'maven' + + - name: Build and Generate Javadoc # POM is configured to output to target/site/apidocs + run: mvn clean javadoc:javadoc + + - name: Deploy Javadoc via Worktree + env: + TAG_NAME: ${{ github.event.inputs.tag_ref }} + run: | + if [ -z "$TAG_NAME" ]; then echo "ERROR: No tag specified"; exit 1; fi + + # 1. Initialize error tracking + EXIT_CODE=0 + + # 2. Configure Git Identity + git config user.email "[email protected]" + git config user.name "github-actions[bot]" + + # 3. Ensure gh-pages exists and is fetched + echo "ECHO: git fetch origin gh-pages" + git fetch origin gh-pages + + # 4. Create worktree for the gh-pages branch in a separate folder + echo "ECHO: git worktree add -B gh-pages ./gh-pages-dir origin/gh-pages" + git worktree add -B gh-pages ./gh-pages-dir origin/gh-pages + + # 5. Deployment Logic in a subshell to capture exit code + ( + set -e + TARGET_PATH="gh-pages-dir/docs/$TAG_NAME" + mkdir -p "$TARGET_PATH" + + echo "ECHO: cp -a target/site/apidocs/. $TARGET_PATH/" + cp -a target/site/apidocs/. "$TARGET_PATH/" + cd gh-pages-dir + + echo "ECHO: git pull origin gh-pages --rebase" + git pull origin gh-pages --rebase + + echo "git add docs/$TAG_NAME" + git add "docs/$TAG_NAME" + + if git diff --staged --quiet; then + echo "No changes detected for Javadoc $TAG_NAME." + else + echo "ECHO: Changes detected for Javadoc $TAG_NAME." + echo "ECHO: git commit ..." + git commit -m "Manual Javadoc deployment for tag $TAG_NAME" + echo "ECHO: git push origin gh-pages" + git push origin gh-pages + fi + ) || EXIT_CODE=$? + + # 6. Cleanup (Always runs) + echo "ECHO: Cleaning up worktree..." + git worktree remove --force ./gh-pages-dir || true + + # 7. Final exit based on subshell success + exit $EXIT_CODE + + - name: Confirm Deployment + if: success() + run: | + echo "ECHO: Javadoc for ${{ github.event.inputs.tag_ref }} is now live on gh-pages." diff --git a/.github/workflows/manual-coverage.yml b/.github/workflows/manual-coverage.yml index 03320e59..2d167189 100644 --- a/.github/workflows/manual-coverage.yml +++ b/.github/workflows/manual-coverage.yml @@ -31,19 +31,19 @@ jobs: steps: - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: persist-credentials: false - name: Cache local Maven repository - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: build-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: build-${{ runner.os }}-maven- - name: Install Matrix JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: ${{ matrix.jdk }} distribution: 'temurin' diff --git a/.github/workflows/manual-os-matrix.yml b/.github/workflows/manual-os-matrix.yml index 9e2d36f6..64674443 100644 --- a/.github/workflows/manual-os-matrix.yml +++ b/.github/workflows/manual-os-matrix.yml @@ -34,19 +34,19 @@ jobs: steps: - name: "Checkout ${{ github.ref }} ( ${{ github.sha }} )" - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: persist-credentials: false - name: Cache local Maven repository - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.m2/repository key: build-${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: build-${{ runner.os }}-maven- - name: Install Matrix JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: java-version: ${{ matrix.jdk }} distribution: 'temurin' diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java index 898c5394..3c194307 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java +++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java @@ -41,7 +41,7 @@ public interface Buffer extends Positional { * @param byteBuffer the given ByteBuffer, must not be null. * @return a new <i>Buffer</i> for read-only operations on the given ByteBuffer. */ - static Buffer wrap(ByteBuffer byteBuffer) { + static Buffer wrap(final ByteBuffer byteBuffer) { return wrap(byteBuffer, byteBuffer.order()); } @@ -58,8 +58,8 @@ public interface Buffer extends Positional { * @return a new <i>Buffer</i> for read-only operations on the given ByteBuffer. */ static Buffer wrap( - ByteBuffer byteBuffer, - ByteOrder byteOrder) { + final ByteBuffer byteBuffer, + final ByteOrder byteOrder) { return BaseWritableBufferImpl.wrapByteBuffer(byteBuffer, true, byteOrder, null); } diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java index b086c6c6..d064b879 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java +++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java @@ -45,7 +45,7 @@ public interface Memory extends Resource { * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null. * @return a new <i>Memory</i> for read-only operations on the given <i>ByteBuffer</i>. */ - static Memory wrap(ByteBuffer byteBuffer) { + static Memory wrap(final ByteBuffer byteBuffer) { return wrap(byteBuffer, byteBuffer.order()); } @@ -60,8 +60,8 @@ public interface Memory extends Resource { * @return a new <i>Memory</i> for read-only operations on the given <i>ByteBuffer</i>. */ static Memory wrap( - ByteBuffer byteBuffer, - ByteOrder byteOrder) { + final ByteBuffer byteBuffer, + final ByteOrder byteOrder) { return BaseWritableMemoryImpl.wrapByteBuffer(byteBuffer, true, byteOrder, null); } @@ -80,7 +80,7 @@ public interface Memory extends Resource { * @throws SecurityException If a security manager is installed and it denies an unspecified permission * required by the implementation. */ - static Memory map(File file) throws IOException { + static Memory map(final File file) throws IOException { return map(file, 0, file.length(), ByteOrder.nativeOrder()); } @@ -97,10 +97,10 @@ public interface Memory extends Resource { * required by the implementation. */ static Memory map( - File file, - long fileOffsetBytes, - long capacityBytes, - ByteOrder byteOrder) throws IOException { + final File file, + final long fileOffsetBytes, + final long capacityBytes, + final ByteOrder byteOrder) throws IOException { return BaseWritableMemoryImpl.wrapMap(file, fileOffsetBytes, capacityBytes, true, byteOrder); } @@ -119,8 +119,8 @@ public interface Memory extends Resource { * offsetBytes and capacityBytes. */ default Memory region( - long offsetBytes, - long capacityBytes) { + final long offsetBytes, + final long capacityBytes) { return region(offsetBytes, capacityBytes, getTypeByteOrder()); } @@ -183,7 +183,7 @@ public interface Memory extends Resource { * @param array the given primitive array. It must be non-null. * @return a new <i>Memory</i> for read operations */ - static Memory wrap(byte[] array) { + static Memory wrap(final byte[] array) { Objects.requireNonNull(array, "array must be non-null"); return wrap(array, 0, array.length, ByteOrder.nativeOrder()); } @@ -195,8 +195,8 @@ public interface Memory extends Resource { * @return a new <i>Memory</i> for read operations */ static Memory wrap( - byte[] array, - ByteOrder byteOrder) { + final byte[] array, + final ByteOrder byteOrder) { return wrap(array, 0, array.length, byteOrder); } @@ -209,10 +209,10 @@ public interface Memory extends Resource { * @return a new <i>Memory</i> for read operations */ static Memory wrap( - byte[] array, - int offsetBytes, - int lengthBytes, - ByteOrder byteOrder) { + final byte[] array, + final int offsetBytes, + final int lengthBytes, + final ByteOrder byteOrder) { return BaseWritableMemoryImpl.wrapHeapArray(array, offsetBytes, lengthBytes, true, byteOrder, null); } @@ -221,7 +221,7 @@ public interface Memory extends Resource { * @param array the given primitive array. It must be non-null. * @return a new <i>Memory</i> for read operations */ - static Memory wrap(char[] array) { + static Memory wrap(final char[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.CHAR.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, true, ByteOrder.nativeOrder(), null); @@ -232,7 +232,7 @@ public interface Memory extends Resource { * @param array the given primitive array. It must be non-null. * @return a new <i>Memory</i> for read operations */ - static Memory wrap(short[] array) { + static Memory wrap(final short[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.SHORT.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, true, ByteOrder.nativeOrder(), null); @@ -243,7 +243,7 @@ public interface Memory extends Resource { * @param array the given primitive array. It must be non-null. * @return a new <i>Memory</i> for read operations */ - static Memory wrap(int[] array) { + static Memory wrap(final int[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.INT.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, true, ByteOrder.nativeOrder(), null); @@ -254,7 +254,7 @@ public interface Memory extends Resource { * @param array the given primitive array. It must be non-null. * @return a new <i>Memory</i> for read operations */ - static Memory wrap(long[] array) { + static Memory wrap(final long[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.LONG.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, true, ByteOrder.nativeOrder(), null); @@ -265,7 +265,7 @@ public interface Memory extends Resource { * @param array the given primitive array. It must be non-null. * @return a new <i>Memory</i> for read operations */ - static Memory wrap(float[] array) { + static Memory wrap(final float[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.FLOAT.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, true, ByteOrder.nativeOrder(), null); @@ -276,7 +276,7 @@ public interface Memory extends Resource { * @param array the given primitive array. It must be non-null. * @return a new <i>Memory</i> for read operations */ - static Memory wrap(double[] array) { + static Memory wrap(final double[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.DOUBLE.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, true, ByteOrder.nativeOrder(), null); diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryRequestServer.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryRequestServer.java index 814aa726..9f4b2c48 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryRequestServer.java +++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryRequestServer.java @@ -44,7 +44,7 @@ public interface MemoryRequestServer { * * @param memToClose the relevant WritableMemory to be considered for closing. It must be non-null. */ - default void requestClose(WritableMemory memToClose) { + default void requestClose(final WritableMemory memToClose) { requestClose(memToClose, null); } diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java index 6e328ccb..50be79f0 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java +++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java @@ -23,8 +23,8 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static org.apache.datasketches.memory.internal.UnsafeUtil.unsafe; /** - * <p>The MurmurHash3 is a fast, non-cryptographic, 128-bit hash function that has - * excellent avalanche and 2-way bit independence properties.</p> + * The MurmurHash3 is a fast, non-cryptographic, 128-bit hash function that has + * excellent avalanche and 2-way bit independence properties. * * <p>Austin Appleby's C++ * <a href="https://github.com/aappleby/smhasher/blob/master/src/MurmurHash3.cpp"> diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Resource.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Resource.java index 00edf16f..8b001287 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Resource.java +++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Resource.java @@ -113,7 +113,7 @@ public interface Resource extends AutoCloseable { * @return true if the given object has equal contents to this object. * @see #equalTo(long, Resource, long, long) */ - default boolean equalTo(Resource that) { + default boolean equalTo(final Resource that) { if (that == null || this.getCapacity() != that.getCapacity()) { return false; } return equalTo(0, that, 0, that.getCapacity()); } diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableBuffer.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableBuffer.java index 99b8858a..d015c8e3 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableBuffer.java +++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableBuffer.java @@ -41,7 +41,7 @@ public interface WritableBuffer extends Buffer { * @param byteBuffer the given ByteBuffer. It must be non-null and writable. * @return a new <i>WritableBuffer</i> for write operations on the given <i>ByteBuffer</i>. */ - static WritableBuffer writableWrap(ByteBuffer byteBuffer) { + static WritableBuffer writableWrap(final ByteBuffer byteBuffer) { return writableWrap(byteBuffer, byteBuffer.order(), defaultMemReqSvr); } @@ -60,9 +60,9 @@ public interface WritableBuffer extends Buffer { * @throws IllegalArgumentException if ByteBuffer is not writable */ static WritableBuffer writableWrap( - ByteBuffer byteBuffer, - ByteOrder byteOrder, - MemoryRequestServer memReqSvr) { + final ByteBuffer byteBuffer, + final ByteOrder byteOrder, + final MemoryRequestServer memReqSvr) { if (byteBuffer.isReadOnly()) { throw new ReadOnlyException("Cannot create a WritableBuffer from a ReadOnly ByteBuffer."); } diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java index d48d3dbc..c83dddf5 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java +++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java @@ -45,7 +45,7 @@ public interface WritableMemory extends Memory { * @param byteBuffer the given <i>ByteBuffer</i>. It must be non-null and writable. * @return a new <i>WritableMemory</i> for write operations on the given <i>ByteBuffer</i>. */ - static WritableMemory writableWrap(ByteBuffer byteBuffer) { + static WritableMemory writableWrap(final ByteBuffer byteBuffer) { return writableWrap(byteBuffer, byteBuffer.order(), null); } @@ -63,9 +63,9 @@ public interface WritableMemory extends Memory { * @throws IllegalArgumentException if ByteBuffer is not writable. */ static WritableMemory writableWrap( - ByteBuffer byteBuffer, - ByteOrder byteOrder, - MemoryRequestServer memReqSvr) { + final ByteBuffer byteBuffer, + final ByteOrder byteOrder, + final MemoryRequestServer memReqSvr) { if (byteBuffer.isReadOnly()) { throw new ReadOnlyException("byteBuffer must be writable."); } return BaseWritableMemoryImpl.wrapByteBuffer(byteBuffer, false, byteOrder, memReqSvr); } @@ -84,7 +84,7 @@ public interface WritableMemory extends Memory { * @throws SecurityException If a security manager is installed and it denies an unspecified permission * required by the implementation. */ - static WritableMemory writableMap(File file) throws IOException { + static WritableMemory writableMap(final File file) throws IOException { return writableMap(file, 0, file.length(), ByteOrder.nativeOrder()); } @@ -101,10 +101,10 @@ public interface WritableMemory extends Memory { * required by the implementation. */ static WritableMemory writableMap( - File file, - long fileOffsetBytes, - long capacityBytes, - ByteOrder byteOrder) throws IOException { + final File file, + final long fileOffsetBytes, + final long capacityBytes, + final ByteOrder byteOrder) throws IOException { if (!file.canWrite()) { throw new ReadOnlyException("file must be writable."); } return BaseWritableMemoryImpl.wrapMap(file, fileOffsetBytes, capacityBytes, false, byteOrder); } @@ -123,7 +123,7 @@ public interface WritableMemory extends Memory { * @param capacityBytes the size of the desired memory in bytes. * @return WritableMemory for this off-heap resource. */ - static WritableMemory allocateDirect(long capacityBytes) { + static WritableMemory allocateDirect(final long capacityBytes) { return allocateDirect(capacityBytes, ByteOrder.nativeOrder(), null); } @@ -142,9 +142,9 @@ public interface WritableMemory extends Memory { * @return a WritableMemory for this off-heap resource. */ static WritableMemory allocateDirect( - long capacityBytes, - ByteOrder byteOrder, - MemoryRequestServer memReqSvr) { + final long capacityBytes, + final ByteOrder byteOrder, + final MemoryRequestServer memReqSvr) { return BaseWritableMemoryImpl.wrapDirect(capacityBytes, byteOrder, memReqSvr); } @@ -163,8 +163,8 @@ public interface WritableMemory extends Memory { * @return a new <i>WritableMemory</i> representing the defined writable region. */ default WritableMemory writableRegion( - long offsetBytes, - long capacityBytes) { + final long offsetBytes, + final long capacityBytes) { return writableRegion(offsetBytes, capacityBytes, getTypeByteOrder()); } @@ -228,7 +228,7 @@ public interface WritableMemory extends Memory { * @param capacityBytes the given capacity in bytes. * @return a new WritableMemory for write operations on a new byte array. */ - static WritableMemory allocate(int capacityBytes) { + static WritableMemory allocate(final int capacityBytes) { return allocate(capacityBytes, ByteOrder.nativeOrder(), null); } @@ -239,8 +239,8 @@ public interface WritableMemory extends Memory { * @return a new WritableMemory for write operations on a new byte array. */ static WritableMemory allocate( - int capacityBytes, - ByteOrder byteOrder) { + final int capacityBytes, + final ByteOrder byteOrder) { return allocate(capacityBytes, byteOrder, null); } @@ -253,9 +253,9 @@ public interface WritableMemory extends Memory { * @return a new WritableMemory for write operations on a new byte array. */ static WritableMemory allocate( - int capacityBytes, - ByteOrder byteOrder, - MemoryRequestServer memReqSvr) { + final int capacityBytes, + final ByteOrder byteOrder, + final MemoryRequestServer memReqSvr) { final byte[] arr = new byte[capacityBytes]; negativeCheck(capacityBytes, "capacityBytes"); return writableWrap(arr, 0, capacityBytes, byteOrder, memReqSvr); @@ -271,7 +271,7 @@ public interface WritableMemory extends Memory { * @param array the given primitive array. It must be non-null. * @return a new WritableMemory for write operations on the given primitive array. */ - static WritableMemory writableWrap(byte[] array) { + static WritableMemory writableWrap(final byte[] array) { return writableWrap(array, 0, array.length, ByteOrder.nativeOrder(), null); } @@ -285,8 +285,8 @@ public interface WritableMemory extends Memory { * @return a new WritableMemory for write operations on the given primitive array. */ static WritableMemory writableWrap( - byte[] array, - ByteOrder byteOrder) { + final byte[] array, + final ByteOrder byteOrder) { return writableWrap(array, 0, array.length, byteOrder, null); } @@ -302,10 +302,10 @@ public interface WritableMemory extends Memory { * @return a new WritableMemory for write operations on the given primitive array. */ static WritableMemory writableWrap( - byte[] array, - int offsetBytes, - int lengthBytes, - ByteOrder byteOrder) { + final byte[] array, + final int offsetBytes, + final int lengthBytes, + final ByteOrder byteOrder) { return writableWrap(array, offsetBytes, lengthBytes, byteOrder, null); } @@ -325,11 +325,11 @@ public interface WritableMemory extends Memory { * @return a new WritableMemory for write operations on the given primitive array. */ static WritableMemory writableWrap( - byte[] array, - int offsetBytes, - int lengthBytes, - ByteOrder byteOrder, - MemoryRequestServer memReqSvr) { + final byte[] array, + final int offsetBytes, + final int lengthBytes, + final ByteOrder byteOrder, + final MemoryRequestServer memReqSvr) { return BaseWritableMemoryImpl.wrapHeapArray(array, offsetBytes, lengthBytes, false, byteOrder, memReqSvr); } @@ -338,7 +338,7 @@ public interface WritableMemory extends Memory { * @param array the given primitive array. It must be non-null. * @return a new WritableMemory for write operations on the given primitive array. */ - static WritableMemory writableWrap(char[] array) { + static WritableMemory writableWrap(final char[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.CHAR.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, false, ByteOrder.nativeOrder(), null); @@ -349,7 +349,7 @@ public interface WritableMemory extends Memory { * @param array the given primitive array. It must be non-null. * @return a new WritableMemory for write operations on the given primitive array. */ - static WritableMemory writableWrap(short[] array) { + static WritableMemory writableWrap(final short[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.SHORT.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, false, ByteOrder.nativeOrder(), null); @@ -360,7 +360,7 @@ public interface WritableMemory extends Memory { * @param array the given primitive array. It must be non-null. * @return a new WritableMemory for write operations on the given primitive array. */ - static WritableMemory writableWrap(int[] array) { + static WritableMemory writableWrap(final int[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.INT.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, false, ByteOrder.nativeOrder(), null); @@ -371,7 +371,7 @@ public interface WritableMemory extends Memory { * @param array the given primitive array. It must be non-null. * @return a new WritableMemory for write operations on the given primitive array. */ - static WritableMemory writableWrap(long[] array) { + static WritableMemory writableWrap(final long[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.LONG.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, false, ByteOrder.nativeOrder(), null); @@ -382,7 +382,7 @@ public interface WritableMemory extends Memory { * @param array the given primitive array. It must be non-null. * @return a new WritableMemory for write operations on the given primitive array. */ - static WritableMemory writableWrap(float[] array) { + static WritableMemory writableWrap(final float[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.FLOAT.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, false, ByteOrder.nativeOrder(), null); @@ -393,7 +393,7 @@ public interface WritableMemory extends Memory { * @param array the given primitive array. It must be non-null. * @return a new WritableMemory for write operations on the given primitive array. */ - static WritableMemory writableWrap(double[] array) { + static WritableMemory writableWrap(final double[] array) { Objects.requireNonNull(array, "array must be non-null"); final long lengthBytes = array.length << Prim.DOUBLE.shift(); return BaseWritableMemoryImpl.wrapHeapArray(array, 0L, lengthBytes, false, ByteOrder.nativeOrder(), null); diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java index d899c0c5..8245f3dc 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java +++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java @@ -151,9 +151,13 @@ public abstract class ResourceImpl implements Resource { * @param p1 The second number group */ static void checkJavaVersion(final String jdkVer, final int p0, final int p1 ) { - final boolean ok = ((p0 == 1) && (p1 == 8)) || (p0 == 8) || (p0 == 11) || (p0 == 17 || (p0 == 21)); + final boolean ok = ((p0 == 1) && (p1 == 8)) || (p0 == 8) || (p0 == 11) || (p0 == 17 || (p0 == 21) || (p0 == 25)); if (!ok) { throw new IllegalArgumentException( - "Unsupported JDK Major Version. It must be one of 1.8, 8, 11, 17, 21: " + jdkVer); + "Unsupported JDK Major Version. It must be one of 1.8, 8, 11, 17, 21, 25: " + jdkVer); + } + if (p0 > 11) { + System.err.println( + "Warning: Java versions > Java 11 can only operate in restriced mode where no off-heap operations are allowed!"); } } diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/package-info.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/package-info.java index eccf1b22..1bf43737 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/package-info.java +++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/package-info.java @@ -18,11 +18,10 @@ */ /** - * <p>This package provides high performance primitive and primitive array access to + * This package provides high performance primitive and primitive array access to * off-heap memory and memory-mapped file resources, consistent views into * {@link java.nio.ByteBuffer}, and on-heap primitive arrays. It can be used as a more * comprehensive and flexible replacement for {@link java.nio.ByteBuffer}. - * </p> * * <p>In addition, this package provides:</p> * --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
