From a729d23dbee367927e191fd001666d1793b579ba Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Sat, 28 Mar 2026 17:12:06 -0700 Subject: [PATCH 01/26] Java version = 11 --- .github/workflows/auto-jdk-os-matrix.yml | 2 +- .github/workflows/javadoc.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index ed180f0e..cfa21530 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - jdk: [ 8 ] + jdk: [ 11 ] os: [ windows-latest, ubuntu-latest, macos-latest ] include: - os: windows-latest diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml index feaa56eb..598dede6 100644 --- a/.github/workflows/javadoc.yml +++ b/.github/workflows/javadoc.yml @@ -29,7 +29,7 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: - java-version: '8' + java-version: '11' distribution: 'temurin' java-package: jdk architecture: x64 From ad9f30c6b63c3cf2150d3af92ea4d08047dbffb0 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 30 Mar 2026 18:05:24 -0700 Subject: [PATCH 02/26] Update auto-jdk-os-matrix.yml for Java 8 --- .github/workflows/auto-jdk-os-matrix.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index cfa21530..23f1ff5e 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - jdk: [ 11 ] + jdk: [ 8 ] os: [ windows-latest, ubuntu-latest, macos-latest ] include: - os: windows-latest @@ -33,4 +33,6 @@ jobs: with: jdk_version: ${{ matrix.jdk }} os_type: ${{ matrix.os }} - java_arch: ${{ matrix.arch }} + cpu_arch: ${{ matrix.arch }} + jdk_distribution: 'temurin' + jvm_args: "" From 82bf2eee9deeb4be0bcc8ddcda65de2a9500b37f Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 30 Mar 2026 18:18:27 -0700 Subject: [PATCH 03/26] correct distribution --- .github/workflows/auto-jdk-os-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index 23f1ff5e..1c44badb 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -34,5 +34,5 @@ jobs: jdk_version: ${{ matrix.jdk }} os_type: ${{ matrix.os }} cpu_arch: ${{ matrix.arch }} - jdk_distribution: 'temurin' + jdk_distribution: 'zulu' jvm_args: "" From 6b43ede2bc66e673e4aafab4a1ffeb67260099b4 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 30 Mar 2026 18:53:59 -0700 Subject: [PATCH 04/26] update auto-jdk-os-matrix.yml --- .github/workflows/auto-jdk-os-matrix.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index 1c44badb..c3e507d2 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - jdk: [ 8 ] + jdk: [ 8, 11 ] os: [ windows-latest, ubuntu-latest, macos-latest ] include: - os: windows-latest @@ -28,11 +28,19 @@ jobs: - os: macos-latest arch: aarch64 + - jdk: 8 + jvm_args: "" + distribution: 'zulu' + + - jdk: 11 + jvm_args: " --add-exports java.base/jdk.internal.misc=org.apache.datasketches.memory --add-exports java.base/jdk.internal.ref=org.apache.datasketches.memory --add-opens java.base/java.nio=org.apache.datasketches.memory --add-opens java.base/sun.nio.ch=org.apache.datasketches.memory" + distribution: 'temurin' + # Reference the reusable workflow on the "workflows" branch uses: apache/datasketches-memory/.github/workflows/reusable-jdk-os-matrix.yml@workflows with: jdk_version: ${{ matrix.jdk }} os_type: ${{ matrix.os }} cpu_arch: ${{ matrix.arch }} - jdk_distribution: 'zulu' - jvm_args: "" + jdk_distribution: ${{ matrix.distribution }} + jvm_args: ${{ matrix.jvm_args }} From 563d099bd656aa6268c7b890c56263268380c6ea Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Tue, 31 Mar 2026 13:23:58 -0700 Subject: [PATCH 05/26] update update_3.0.X --- pom.xml | 139 ++++++++++++++++++++++++++------------------------------ 1 file changed, 64 insertions(+), 75 deletions(-) diff --git a/pom.xml b/pom.xml index c9444eeb..24390c57 100644 --- a/pom.xml +++ b/pom.xml @@ -41,11 +41,11 @@ under the License. https://mail-archives.apache.org/mod_mbox/datasketches-dev - sketches-user - https://groups.google.com/forum/#!forum/sketches-user - mailto:sketches-user%2Bsubscribe@googlegroups.com - mailto:sketches-user%2Bunsubscribe@googlegroups.com - mailto:sketches-user@googlegroups.com + DataSketches Users + user-subscribe@datasketches.apache.org + user-unsubscribe@datasketches.apache.org + user@datasketches.apache.org + https://mail-archives.apache.org/mod_mbox/datasketches-user @@ -57,8 +57,6 @@ under the License. - - GitHub https://github.com/apache/${project.artifactId}/issues @@ -95,38 +93,48 @@ under the License. 8 ${java.version} ${java.version} - -Xmx4g -Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8 + -Xmx4g + -Duser.language=en + -Duser.country=US + -Dfile.encoding=UTF-8 + ${jvm.mem} ${jvm.locale.language} ${jvm.locale.country} ${jvm.locale.encoding} UTF-8 ${charset.encoding} ${charset.encoding} ${charset.encoding} - - - 3.7.1 - 3.13.0 - 3.1.2 - 3.4.1 - 3.2.3 - 3.0.0-M1 - 3.4.1 - 3.6.3 - 3.0.1 + ${project.build.directory}/site + yyyy-MM-dd'T'HH-mm-ss'Z' + + + 3.15.0 + 3.1.4 + 3.6.2 + 3.2.8 + 3.1.4 + 3.4.2 + 3.12.0 + 3.3.1 3.2.0 - 3.3.1 - 3.2.5 + 3.4.0 + 3.5.4 3.2.0 - - 4.9.10 - + + 0.16.1 - + + - 4.3.0 - - 0.8.12 + 5.0.0 + + + 9.0.2 + + + 0.8.14 + - 2.16.2 3.3.0 + 1.0.0 @@ -183,9 +191,14 @@ under the License. - org.codehaus.mojo - versions-maven-plugin - ${versions-maven-plugin.version} + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + + ${jdk-toolchain.version} + + @@ -259,11 +272,16 @@ under the License. - - [8,9),[11,12) - + - [${maven.version},) + [${maven.version},4.0.0) @@ -352,13 +370,6 @@ under the License. org.apache.maven.plugins maven-toolchains-plugin ${maven-toolchains-plugin.version} - - - - [8,9),[11,12) - - - @@ -366,6 +377,13 @@ under the License. + + + + ${java.version} + + + @@ -385,7 +403,7 @@ under the License. - org.eluder.coveralls + com.github.hazendaz.maven coveralls-maven-plugin ${coveralls-maven-plugin.version} @@ -396,16 +414,7 @@ under the License. - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - - ${jdk-toolchain.version} - - - + org.codehaus.mojo @@ -453,33 +462,13 @@ under the License. jacoco-maven-plugin - org.eluder.coveralls + com.github.hazendaz.maven coveralls-maven-plugin - - - apache-release - - - - maven-assembly-plugin - ${maven-assembly-plugin.version} - - - source-release-assembly - none - - - - - - only-eclipse From 96c9ca286034c7015558ca3fd96ae8d9d1fc27be Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Tue, 31 Mar 2026 17:51:15 -0700 Subject: [PATCH 06/26] minor fixes to update_3.0.X --- .../memory/internal/CommonMemoryTest.java | 1 - .../memory/internal/SpecificLeafTest.java | 12 +- ...yCheckstyle.xml => SketchesCheckstyle.xml} | 138 ++++++++++-------- tools/suppressions.xml | 31 ---- 4 files changed, 82 insertions(+), 100 deletions(-) rename tools/{MemoryCheckstyle.xml => SketchesCheckstyle.xml} (92%) delete mode 100644 tools/suppressions.xml diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonMemoryTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonMemoryTest.java index 89697019..a1d2e7fb 100644 --- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonMemoryTest.java +++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonMemoryTest.java @@ -93,7 +93,6 @@ public void checkSetGetArrays() throws Exception { } public static void setGetArraysTests(WritableMemory mem) { - int accessCapacity = (int)mem.getCapacity(); int words = 4; diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java index 9eabcd8f..9c0e9ae0 100644 --- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java +++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java @@ -47,7 +47,7 @@ public void checkByteBufferLeaves() { ResourceImpl bsi = (ResourceImpl)mem; int typeId = bsi.getTypeId(); assertTrue(bsi.hasByteBuffer()); - assertTrue(bsi.isNativeOrder(typeId)); + assertTrue(ResourceImpl.isNativeOrder(typeId)); assertTrue(mem.isReadOnly()); checkCrossLeafTypeIds(mem); Buffer buf = mem.asBuffer().region(0, bytes, ByteOrder.nativeOrder()); @@ -160,31 +160,31 @@ private static void checkCrossLeafTypeIds(Memory mem) { assertTrue(((ResourceImpl)reg1).isRegionView()); Buffer buf1 = reg1.asBuffer(); assertTrue(((ResourceImpl)buf1).isRegionView()); - assertTrue(((ResourceImpl)buf1).isBuffer(((ResourceImpl)buf1).getTypeId())); + assertTrue(ResourceImpl.isBuffer(((ResourceImpl)buf1).getTypeId())); assertTrue(buf1.isReadOnly()); Buffer buf2 = buf1.duplicate(); assertTrue(((ResourceImpl)buf2).isRegionView()); - assertTrue(((ResourceImpl)buf2).isBuffer(((ResourceImpl)buf2).getTypeId())); + assertTrue(ResourceImpl.isBuffer(((ResourceImpl)buf2).getTypeId())); assertTrue(((ResourceImpl)buf2).isDuplicate()); assertTrue(buf2.isReadOnly()); Memory mem2 = buf1.asMemory(); // assertTrue(((ResourceImpl)mem2).isRegionView()); - assertFalse(((ResourceImpl)mem2).isBuffer(((ResourceImpl)mem2).getTypeId())); + assertFalse(ResourceImpl.isBuffer(((ResourceImpl)mem2).getTypeId())); assertFalse(((ResourceImpl)mem2).isDuplicate()); assertTrue(mem2.isReadOnly()); Buffer buf3 = buf1.duplicate(Util.NON_NATIVE_BYTE_ORDER); assertTrue(((ResourceImpl)buf3).isRegionView()); - assertTrue(((ResourceImpl)buf3).isBuffer(((ResourceImpl)buf3).getTypeId())); + assertTrue(ResourceImpl.isBuffer(((ResourceImpl)buf3).getTypeId())); assertTrue(((ResourceImpl)buf3).isDuplicate()); assertTrue(((ResourceImpl)buf3).isNonNativeOrder()); assertTrue(buf3.isReadOnly()); Memory mem3 = buf3.asMemory(); assertTrue(((ResourceImpl)mem3).isRegionView()); - assertFalse(((ResourceImpl)mem3).isBuffer(((ResourceImpl)mem3).getTypeId())); + assertFalse(ResourceImpl.isBuffer(((ResourceImpl)mem3).getTypeId())); assertTrue(((ResourceImpl)mem3).isDuplicate()); assertTrue(((ResourceImpl)mem3).isNonNativeOrder()); assertTrue(mem3.isReadOnly()); diff --git a/tools/MemoryCheckstyle.xml b/tools/SketchesCheckstyle.xml similarity index 92% rename from tools/MemoryCheckstyle.xml rename to tools/SketchesCheckstyle.xml index e5f0b855..1d4a387b 100644 --- a/tools/MemoryCheckstyle.xml +++ b/tools/SketchesCheckstyle.xml @@ -1,7 +1,7 @@ + "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" + "https://checkstyle.org/dtds/configuration_1_3.dtd"> + + - + - + + - + - + + - + - + @@ -64,22 +68,27 @@ under the License. - + + - + - + - + + + + + - + @@ -87,49 +96,49 @@ under the License. - + - + - + - + - - + + - + - + - + @@ -137,46 +146,51 @@ under the License. - + - + - + - + - + - + - + + + + + + - + - + - + @@ -184,11 +198,11 @@ under the License. - + - + - + @@ -197,40 +211,40 @@ under the License. - + - + - + - + - + - + - + @@ -245,12 +259,12 @@ under the License. - + - + @@ -261,27 +275,27 @@ under the License. - + - + - + - + - + @@ -355,13 +369,13 @@ under the License. - + - + @@ -372,26 +386,26 @@ under the License. - + - + - + - + - + - + @@ -403,4 +417,4 @@ under the License. - \ No newline at end of file + diff --git a/tools/suppressions.xml b/tools/suppressions.xml deleted file mode 100644 index 58cdce75..00000000 --- a/tools/suppressions.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - From f6b9ed3e5d166a76601796c6656b79178652be97 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Thu, 2 Apr 2026 17:53:45 -0700 Subject: [PATCH 07/26] Update pom --- pom.xml | 284 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 145 insertions(+), 139 deletions(-) diff --git a/pom.xml b/pom.xml index 24390c57..6a9762a6 100644 --- a/pom.xml +++ b/pom.xml @@ -17,8 +17,11 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + + 4.0.0 @@ -31,6 +34,14 @@ under the License. High-performance native memory access. https://datasketches.apache.org/ 2015 + + + + Apache-2.0 + https://www.apache.org/licenses/LICENSE-2.0.txt + repo + + @@ -56,6 +67,19 @@ under the License. HEAD + + + apache.releases.https + Apache Release Distribution Repository + https://repository.apache.org/service/local/staging/deploy/maven2 + + + apache.snapshots.https + Apache Development Snapshot Repository + https://repository.apache.org/content/repositories/snapshots + + + GitHub https://github.com/apache/${project.artifactId}/issues @@ -71,26 +95,13 @@ under the License. - - - - - 0.16 - 7.5.1 - 3.6.3 + 3.9.12 8 - 8 ${java.version} ${java.version} -Xmx4g @@ -99,13 +110,15 @@ under the License. -Dfile.encoding=UTF-8 ${jvm.mem} ${jvm.locale.language} ${jvm.locale.country} ${jvm.locale.encoding} UTF-8 + 2026-01-09T19:00:20Z ${charset.encoding} ${charset.encoding} + ${charset.encoding} ${charset.encoding} ${project.build.directory}/site yyyy-MM-dd'T'HH-mm-ss'Z' - + 3.15.0 3.1.4 3.6.2 @@ -114,14 +127,13 @@ under the License. 3.4.2 3.12.0 3.3.1 - 3.2.0 3.4.0 - 3.5.4 + 3.5.4 3.2.0 - - - 0.16.1 - + + + 0.17 + 5.0.0 @@ -132,22 +144,24 @@ under the License. 0.8.14 - - 3.3.0 - 1.0.0 - + + + 3.3.0 + + + 0.16 + true - true true - + apache.snapshots Apache Snapshot Repository - https://repository.apache.org/content/groups/snapshots/org/apache/datasketches/ + https://repository.apache.org/content/groups/snapshots false @@ -158,7 +172,7 @@ under the License. apache Apache Releases Repository - https://repository.apache.org/content/repositories/releases/org/apache/datasketches/ + https://repository.apache.org/content/groups/public true @@ -190,13 +204,34 @@ under the License. + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.6.0 + + + com.puppycrawl.tools + checkstyle + 13.4.0 + + + + + 25 + + tools/SketchesCheckstyle.xml + true + true + + + org.apache.maven.plugins maven-compiler-plugin ${maven-compiler-plugin.version} - ${jdk-toolchain.version} + ${java.version} @@ -211,8 +246,42 @@ under the License. org.apache.maven.plugins - maven-release-plugin - ${maven-release-plugin.version} + maven-enforcer-plugin + ${maven-enforcer-plugin.version} + + + enforce-banned-dependencies + + enforce + + + + + + [${maven.version},4.0.0) + + + + + com.google.code.findbugs:annotations + + + + true + + + + + + + org.apache.maven.plugins + maven-install-plugin + ${maven-install-plugin.version} @@ -245,7 +314,7 @@ under the License. true none - ${jdk-toolchain.version} + ${java.version} org.apache.datasketches.memory.internal @@ -262,71 +331,8 @@ under the License. org.apache.maven.plugins - maven-enforcer-plugin - ${maven-enforcer-plugin.version} - - - enforce-banned-dependencies - - enforce - - - - - - [${maven.version},4.0.0) - - - - - com.google.code.findbugs:annotations - - - - true - - - - - - - org.apache.rat - apache-rat-plugin - ${apache-rat-plugin.version} - - - verify - - check - - - - - ${project.basedir}/rat - true - true - - **/*.yaml - **/*.yml - **/toolchains.xml - **/.* - **/.clover/**/* - **/test/resources/**/*.txt - **/test-output/**/* - **/img/**/*.png - **/git.properties - **/scripts/assets/LoremIpsum.txt - LICENSE - NOTICE - - + maven-release-plugin + ${maven-release-plugin.version} @@ -354,7 +360,7 @@ under the License. org.apache.maven.plugins maven-surefire-plugin - ${maven-surefire-failsafe-plugin.version} + ${maven-surefire-failsafe-plugins.version} false false @@ -380,12 +386,45 @@ under the License. - ${java.version} + ${java.version} + + org.apache.rat + apache-rat-plugin + ${apache-rat-plugin.version} + + + verify + + check + + + + + ${project.basedir}/rat + true + true + + **/*.yaml + **/*.yml + **/toolchains.xml + **/.* + **/.clover/**/* + **/test/resources/**/*.txt + **/test-output/**/* + **/img/**/*.png + **/git.properties + **/scripts/assets/LoremIpsum.txt + LICENSE + NOTICE + + + + org.jacoco @@ -414,8 +453,6 @@ under the License. - - org.codehaus.mojo exec-maven-plugin @@ -468,41 +505,10 @@ under the License. - - - - only-eclipse - - - m2e.version - - - - - - - org.apache.maven.plugins - maven-remote-resources-plugin - ${maven-remote-resources-plugin.version} - - - process-resource-bundles - none - - - - - - - - - - - + datasketches-memory-java8 datasketches-memory-java11 From 4f2d334553d172c5a365cae352589f5568a8a1bd Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 6 Apr 2026 09:52:56 -0700 Subject: [PATCH 08/26] Update poms --- datasketches-memory-java11/pom.xml | 27 +++++- pom.xml | 142 ++++++++++++++++------------- 2 files changed, 104 insertions(+), 65 deletions(-) diff --git a/datasketches-memory-java11/pom.xml b/datasketches-memory-java11/pom.xml index 3f62410f..199b1c8d 100644 --- a/datasketches-memory-java11/pom.xml +++ b/datasketches-memory-java11/pom.xml @@ -48,6 +48,7 @@ under the License. maven-compiler-plugin ${maven-compiler-plugin.version} + true --add-exports java.base/jdk.internal.ref=org.apache.datasketches.memory @@ -56,6 +57,26 @@ under the License. + + + org.apache.maven.plugins + maven-toolchains-plugin + + + + toolchain + + + + + + + ${java.version} + + + + + @@ -67,10 +88,10 @@ under the License. - ${maven.multiModuleProjectDirectory}/tools/scripts/package-multi-release-jar.sh + ${session.rootDirectory}/tools/scripts/package-multi-release-jar.sh ${env.JAVA_HOME} ${project.version} - ${maven.multiModuleProjectDirectory} + ${session.rootDirectory} exec:exec @@ -79,7 +100,7 @@ under the License. org.codehaus.mojo exec-maven-plugin - ${exec-maven-plugin.version} + ${exec-maven-plugin.version} package-mr-jar diff --git a/pom.xml b/pom.xml index 6a9762a6..b55e66ae 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ under the License. HEAD - + apache.releases.https Apache Release Distribution Repository @@ -138,6 +138,9 @@ under the License. 5.0.0 + + 3.6.3 + 9.0.2 @@ -147,11 +150,8 @@ under the License. 1.0.0 - - 3.3.0 - - 0.16 + 2026.0 true true @@ -204,41 +204,17 @@ under the License. - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.6.0 - - - com.puppycrawl.tools - checkstyle - 13.4.0 - - - - - 25 - - tools/SketchesCheckstyle.xml - true - true - - - org.apache.maven.plugins maven-compiler-plugin ${maven-compiler-plugin.version} - - ${java.version} - + true - - + org.apache.maven.plugins maven-deploy-plugin ${maven-deploy-plugin.version} @@ -311,11 +287,16 @@ under the License. maven-javadoc-plugin ${maven-javadoc-plugin.version} + ${project.reporting.outputDirectory} true - none - - ${java.version} - + public + none + + -J${jvm.mem} + -J${jvm.locale.language} + -J${jvm.locale.country} + -J${jvm.locale.encoding} + org.apache.datasketches.memory.internal @@ -329,7 +310,7 @@ under the License. - + org.apache.maven.plugins maven-release-plugin ${maven-release-plugin.version} @@ -362,13 +343,12 @@ under the License. maven-surefire-plugin ${maven-surefire-failsafe-plugins.version} + @{argLine} @{jvm.args} false false true - - ${jdk-toolchain.version} - ${project.build.directory}/test-output/${maven.build.timestamp} + false @@ -411,12 +391,10 @@ under the License. **/*.yaml **/*.yml - **/toolchains.xml **/.* **/.clover/**/* **/test/resources/**/*.txt **/test-output/**/* - **/img/**/*.png **/git.properties **/scripts/assets/LoremIpsum.txt LICENSE @@ -425,6 +403,25 @@ under the License. + + + com.github.hazendaz.maven + coveralls-maven-plugin + ${coveralls-maven-plugin.version} + + + ${coveralls-repo-token} + + ${session.rootDirectory}/datasketches-memory-java8/target/site/jacoco/jacoco.xml + + + + + io.github.git-commit-id + git-commit-id-maven-plugin + ${git-commit-id-maven-plugin.version} + + org.jacoco @@ -437,22 +434,16 @@ under the License. prepare-agent + + default-report + test + + report + + - - - com.github.hazendaz.maven - coveralls-maven-plugin - ${coveralls-maven-plugin.version} - - - ${coveralls-repo-token} - - ${maven.multiModuleProjectDirectory}/datasketches-memory-java8/target/site/jacoco/jacoco.xml - - - org.codehaus.mojo exec-maven-plugin @@ -461,47 +452,74 @@ under the License. + + + + org.apache.maven.plugins + maven-compiler-plugin + + org.apache.maven.plugins maven-deploy-plugin + org.apache.maven.plugins - maven-release-plugin + maven-enforcer-plugin + org.apache.maven.plugins maven-jar-plugin + org.apache.maven.plugins maven-javadoc-plugin + org.apache.maven.plugins - maven-enforcer-plugin - - - org.apache.rat - apache-rat-plugin + maven-release-plugin + org.apache.maven.plugins maven-source-plugin + org.apache.maven.plugins maven-surefire-plugin + - org.jacoco - jacoco-maven-plugin + org.apache.maven.plugins + maven-toolchains-plugin + + + + org.apache.rat + apache-rat-plugin + com.github.hazendaz.maven coveralls-maven-plugin + + + io.github.git-commit-id + git-commit-id-maven-plugin + + + + org.jacoco + jacoco-maven-plugin + + From 8906b2bddd29c44f472a9a62cb03698be16d314f Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Fri, 10 Apr 2026 17:55:48 -0700 Subject: [PATCH 09/26] remove 11 from GHA matrix --- .github/workflows/auto-jdk-os-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index c3e507d2..c493fbfb 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - jdk: [ 8, 11 ] + jdk: [ 8 ] os: [ windows-latest, ubuntu-latest, macos-latest ] include: - os: windows-latest From 252c330ae3e68eac0ad02d7c56f93c756da440c4 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Fri, 10 Apr 2026 18:19:14 -0700 Subject: [PATCH 10/26] Update workflow --- .github/workflows/auto-jdk-os-matrix.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index c493fbfb..92464734 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -32,9 +32,9 @@ jobs: jvm_args: "" distribution: 'zulu' - - jdk: 11 - jvm_args: " --add-exports java.base/jdk.internal.misc=org.apache.datasketches.memory --add-exports java.base/jdk.internal.ref=org.apache.datasketches.memory --add-opens java.base/java.nio=org.apache.datasketches.memory --add-opens java.base/sun.nio.ch=org.apache.datasketches.memory" - distribution: 'temurin' +# - jdk: 11 +# jvm_args: " --add-exports java.base/jdk.internal.misc=org.apache.datasketches.memory --add-exports java.base/jdk.internal.ref=org.apache.datasketches.memory --add-opens java.base/java.nio=org.apache.datasketches.memory --add-opens java.base/sun.nio.ch=org.apache.datasketches.memory" +# distribution: 'temurin' # Reference the reusable workflow on the "workflows" branch uses: apache/datasketches-memory/.github/workflows/reusable-jdk-os-matrix.yml@workflows From c6f25df6dface643c08866925b5801d4fec1aa0a Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 13 Apr 2026 14:06:34 -0700 Subject: [PATCH 11/26] Adding jdk 11 back in. --- .github/workflows/auto-jdk-os-matrix.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index 92464734..c3e507d2 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - jdk: [ 8 ] + jdk: [ 8, 11 ] os: [ windows-latest, ubuntu-latest, macos-latest ] include: - os: windows-latest @@ -32,9 +32,9 @@ jobs: jvm_args: "" distribution: 'zulu' -# - jdk: 11 -# jvm_args: " --add-exports java.base/jdk.internal.misc=org.apache.datasketches.memory --add-exports java.base/jdk.internal.ref=org.apache.datasketches.memory --add-opens java.base/java.nio=org.apache.datasketches.memory --add-opens java.base/sun.nio.ch=org.apache.datasketches.memory" -# distribution: 'temurin' + - jdk: 11 + jvm_args: " --add-exports java.base/jdk.internal.misc=org.apache.datasketches.memory --add-exports java.base/jdk.internal.ref=org.apache.datasketches.memory --add-opens java.base/java.nio=org.apache.datasketches.memory --add-opens java.base/sun.nio.ch=org.apache.datasketches.memory" + distribution: 'temurin' # Reference the reusable workflow on the "workflows" branch uses: apache/datasketches-memory/.github/workflows/reusable-jdk-os-matrix.yml@workflows From 3c84aaf59899a3c3180acdd0b62aecf0f92ae440 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Sat, 18 Apr 2026 11:57:45 -0700 Subject: [PATCH 12/26] Update update_main --- .gitignore | 1 + .mvn/maven.config | 5 ++ datasketches-memory-java11/pom.xml | 57 ++++++++++++------- .../src/main/java/module-info.java | 25 -------- datasketches-memory-java8/pom.xml | 6 +- pom.xml | 1 + 6 files changed, 48 insertions(+), 47 deletions(-) create mode 100644 .mvn/maven.config delete mode 100644 datasketches-memory-java11/src/main/java/module-info.java diff --git a/.gitignore b/.gitignore index f36d4f43..3a308a5c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ datasketches-memory*/.gitignore .classpath .project .settings/ +.factorypath .checkstyle # IntelliJ project files diff --git a/.mvn/maven.config b/.mvn/maven.config new file mode 100644 index 00000000..87735fa0 --- /dev/null +++ b/.mvn/maven.config @@ -0,0 +1,5 @@ +# suppresses the warning: +# Direct modification of testCompileSourceRoots through add() is deprecated and will not work in Maven 4.0.0. Please use the add/remove methods instead. +# If you're using a plugin that causes this warning, please upgrade to the latest version and report an issue if the warning persists. +# To disable these warnings, set -Dmaven.project.sourceRoots.warningsDisabled=true on the command line or in the .mvn/maven.config file. +-Dmaven.project.sourceRoots.warningsDisabled=true diff --git a/datasketches-memory-java11/pom.xml b/datasketches-memory-java11/pom.xml index 199b1c8d..0418725d 100644 --- a/datasketches-memory-java11/pom.xml +++ b/datasketches-memory-java11/pom.xml @@ -17,8 +17,10 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 @@ -37,27 +39,34 @@ under the License. 11 ${java.version} ${java.version} - true + >true + true + + --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED + + --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED + + --add-opens=java.base/java.nio=ALL-UNNAMED + + --add-opens=java.base/sun.nio.ch=ALL-UNNAMED - - - - org.apache.maven.plugins - maven-compiler-plugin - ${maven-compiler-plugin.version} - - true - - --add-exports - java.base/jdk.internal.ref=org.apache.datasketches.memory - - - - - + + org.apache.maven.plugins + maven-compiler-plugin + + true + + ${arg.jdk.internal.ref} + ${arg.jdk.internal.misc} + ${arg.java.nio} + ${arg.sun.nio.ch} + + + + org.apache.maven.plugins maven-toolchains-plugin @@ -76,10 +85,11 @@ under the License. - + + assemble-mr-jar @@ -120,4 +130,11 @@ under the License. + + + org.apache.datasketches + datasketches-memory-java8 + 3.0.2 + + diff --git a/datasketches-memory-java11/src/main/java/module-info.java b/datasketches-memory-java11/src/main/java/module-info.java deleted file mode 100644 index 07163cf3..00000000 --- a/datasketches-memory-java11/src/main/java/module-info.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -module org.apache.datasketches.memory { - requires java.base; - requires java.logging; - requires jdk.unsupported; - - exports org.apache.datasketches.memory; -} \ No newline at end of file diff --git a/datasketches-memory-java8/pom.xml b/datasketches-memory-java8/pom.xml index fb2eb701..78e05201 100644 --- a/datasketches-memory-java8/pom.xml +++ b/datasketches-memory-java8/pom.xml @@ -17,8 +17,10 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> - + 4.0.0 diff --git a/pom.xml b/pom.xml index b55e66ae..3d851a03 100644 --- a/pom.xml +++ b/pom.xml @@ -392,6 +392,7 @@ under the License. **/*.yaml **/*.yml **/.* + **/_* **/.clover/**/* **/test/resources/**/*.txt **/test-output/**/* From 94d1acd2ff71f21d89a0227ce5ad36191662bdd3 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 20 Apr 2026 10:01:41 -0700 Subject: [PATCH 13/26] update 3.0.X --- datasketches-memory-java11/pom.xml | 2 +- datasketches-memory-java8/pom.xml | 4 ++-- pom.xml | 10 ++++++++++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/datasketches-memory-java11/pom.xml b/datasketches-memory-java11/pom.xml index 0418725d..a891a7cd 100644 --- a/datasketches-memory-java11/pom.xml +++ b/datasketches-memory-java11/pom.xml @@ -80,7 +80,7 @@ under the License. - ${java.version} + ${java.version} diff --git a/datasketches-memory-java8/pom.xml b/datasketches-memory-java8/pom.xml index 78e05201..401f3b03 100644 --- a/datasketches-memory-java8/pom.xml +++ b/datasketches-memory-java8/pom.xml @@ -55,7 +55,7 @@ under the License. test - + diff --git a/pom.xml b/pom.xml index 3d851a03..42472dfa 100644 --- a/pom.xml +++ b/pom.xml @@ -471,6 +471,11 @@ under the License. maven-enforcer-plugin + + org.apache.maven.plugins + maven-install-plugin + + org.apache.maven.plugins maven-jar-plugin @@ -520,6 +525,11 @@ under the License. org.jacoco jacoco-maven-plugin + + + org.codehaus.mojo + exec-maven-plugin + From be33f5decd19a31e2809ea42c298b84076c8714f Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 20 Apr 2026 10:16:22 -0700 Subject: [PATCH 14/26] update 3.0.X --- .github/workflows/auto-jdk-os-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index c3e507d2..7fcbd1e3 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - jdk: [ 8, 11 ] + jdk: [ 1.8, 11 ] os: [ windows-latest, ubuntu-latest, macos-latest ] include: - os: windows-latest From 4374ebf44810ebea9a3718517b063238608733fe Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 20 Apr 2026 10:21:46 -0700 Subject: [PATCH 15/26] update 3.0.X --- .github/workflows/auto-jdk-os-matrix.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index 7fcbd1e3..6500b039 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -28,7 +28,7 @@ jobs: - os: macos-latest arch: aarch64 - - jdk: 8 + - jdk: 1.8 jvm_args: "" distribution: 'zulu' From 34b80934a235377e66bb3f9d582a535708d3325c Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 20 Apr 2026 10:39:36 -0700 Subject: [PATCH 16/26] update 3.0.X --- .github/workflows/auto-jdk-os-matrix.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index 6500b039..a41fd71d 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -29,12 +29,11 @@ jobs: arch: aarch64 - jdk: 1.8 - jvm_args: "" distribution: 'zulu' - + jvm_args: "" - jdk: 11 - jvm_args: " --add-exports java.base/jdk.internal.misc=org.apache.datasketches.memory --add-exports java.base/jdk.internal.ref=org.apache.datasketches.memory --add-opens java.base/java.nio=org.apache.datasketches.memory --add-opens java.base/sun.nio.ch=org.apache.datasketches.memory" distribution: 'temurin' + jvm_args: "--add-exports java.base/jdk.internal.misc=org.apache.datasketches.memory --add-exports java.base/jdk.internal.ref=org.apache.datasketches.memory --add-opens java.base/java.nio=org.apache.datasketches.memory --add-opens java.base/sun.nio.ch=org.apache.datasketches.memory" # Reference the reusable workflow on the "workflows" branch uses: apache/datasketches-memory/.github/workflows/reusable-jdk-os-matrix.yml@workflows From 8be3a9646fcad762292da181144d1ab65bb23077 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 20 Apr 2026 10:46:09 -0700 Subject: [PATCH 17/26] update 3.0.X --- .github/workflows/auto-jdk-os-matrix.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index a41fd71d..35a1f2db 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - jdk: [ 1.8, 11 ] + jdk: [ 8, 11 ] os: [ windows-latest, ubuntu-latest, macos-latest ] include: - os: windows-latest @@ -28,7 +28,7 @@ jobs: - os: macos-latest arch: aarch64 - - jdk: 1.8 + - jdk: 8 distribution: 'zulu' jvm_args: "" - jdk: 11 From 70b60aefaeb4d2af7311e5b44d27d783602f510e Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 20 Apr 2026 13:55:54 -0700 Subject: [PATCH 18/26] update 3.0.X --- datasketches-memory-java8/pom.xml | 4 ++-- pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/datasketches-memory-java8/pom.xml b/datasketches-memory-java8/pom.xml index 401f3b03..44c6db8c 100644 --- a/datasketches-memory-java8/pom.xml +++ b/datasketches-memory-java8/pom.xml @@ -35,8 +35,8 @@ under the License. jar - 8 - 8 + 1.8 + 1.8 ${java.version} ${java.version} false diff --git a/pom.xml b/pom.xml index 42472dfa..1780b498 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,7 @@ under the License. 3.9.12 - 8 + 1.8 ${java.version} ${java.version} -Xmx4g From 5609656c182b4efa725449985283cdd8076c0b7d Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 20 Apr 2026 14:09:52 -0700 Subject: [PATCH 19/26] update 3.0.X --- .github/workflows/auto-jdk-os-matrix.yml | 2 +- .github/workflows/javadoc.yml | 4 ++-- datasketches-memory-java8/pom.xml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/auto-jdk-os-matrix.yml b/.github/workflows/auto-jdk-os-matrix.yml index 35a1f2db..eea189cd 100644 --- a/.github/workflows/auto-jdk-os-matrix.yml +++ b/.github/workflows/auto-jdk-os-matrix.yml @@ -32,7 +32,7 @@ jobs: distribution: 'zulu' jvm_args: "" - jdk: 11 - distribution: 'temurin' + distribution: 'zulu' jvm_args: "--add-exports java.base/jdk.internal.misc=org.apache.datasketches.memory --add-exports java.base/jdk.internal.ref=org.apache.datasketches.memory --add-opens java.base/java.nio=org.apache.datasketches.memory --add-opens java.base/sun.nio.ch=org.apache.datasketches.memory" # Reference the reusable workflow on the "workflows" branch diff --git a/.github/workflows/javadoc.yml b/.github/workflows/javadoc.yml index 598dede6..4a7d5fb7 100644 --- a/.github/workflows/javadoc.yml +++ b/.github/workflows/javadoc.yml @@ -29,8 +29,8 @@ jobs: - name: Set up JDK uses: actions/setup-java@v4 with: - java-version: '11' - distribution: 'temurin' + java-version: '8' + distribution: 'zulu' java-package: jdk architecture: x64 cache: 'maven' diff --git a/datasketches-memory-java8/pom.xml b/datasketches-memory-java8/pom.xml index 44c6db8c..a172652e 100644 --- a/datasketches-memory-java8/pom.xml +++ b/datasketches-memory-java8/pom.xml @@ -35,8 +35,8 @@ under the License. jar - 1.8 - 1.8 + 8 + ${java.version} ${java.version} ${java.version} false From b6180aa1245d06a2fcd00cd575c09a4d6adc45f6 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 20 Apr 2026 14:12:02 -0700 Subject: [PATCH 20/26] update 3.0.X --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 1780b498..42472dfa 100644 --- a/pom.xml +++ b/pom.xml @@ -101,7 +101,7 @@ under the License. 3.9.12 - 1.8 + 8 ${java.version} ${java.version} -Xmx4g From 6e0b58e56539d025d87f558c635d2807bf513eb6 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Mon, 20 Apr 2026 17:29:26 -0700 Subject: [PATCH 21/26] update_3.0.X --- .mvn/maven.config | 1 + datasketches-memory-java11/pom.xml | 10 +++--- pom.xml | 51 ++++++++++++++++-------------- 3 files changed, 34 insertions(+), 28 deletions(-) diff --git a/.mvn/maven.config b/.mvn/maven.config index 87735fa0..db5ce585 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -3,3 +3,4 @@ # If you're using a plugin that causes this warning, please upgrade to the latest version and report an issue if the warning persists. # To disable these warnings, set -Dmaven.project.sourceRoots.warningsDisabled=true on the command line or in the .mvn/maven.config file. -Dmaven.project.sourceRoots.warningsDisabled=true +-Dproject.root=${session.rootDirectory} diff --git a/datasketches-memory-java11/pom.xml b/datasketches-memory-java11/pom.xml index a891a7cd..ef3194f3 100644 --- a/datasketches-memory-java11/pom.xml +++ b/datasketches-memory-java11/pom.xml @@ -46,9 +46,9 @@ under the License. --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED - --add-opens=java.base/java.nio=ALL-UNNAMED - - --add-opens=java.base/sun.nio.ch=ALL-UNNAMED + + + @@ -98,10 +98,10 @@ under the License. - ${session.rootDirectory}/tools/scripts/package-multi-release-jar.sh + ${project.root}/tools/scripts/package-multi-release-jar.sh ${env.JAVA_HOME} ${project.version} - ${session.rootDirectory} + ${project.root} exec:exec diff --git a/pom.xml b/pom.xml index 42472dfa..511bd7d5 100644 --- a/pom.xml +++ b/pom.xml @@ -213,13 +213,13 @@ under the License. + org.apache.maven.plugins maven-deploy-plugin ${maven-deploy-plugin.version} - +--> org.apache.maven.plugins maven-enforcer-plugin @@ -260,6 +260,7 @@ under the License. ${maven-install-plugin.version} + org.apache.maven.plugins maven-javadoc-plugin @@ -310,7 +311,8 @@ under the License. - + org.apache.maven.plugins maven-surefire-plugin @@ -387,20 +389,23 @@ under the License. ${project.basedir}/rat true - true - - **/*.yaml - **/*.yml - **/.* - **/_* - **/.clover/**/* - **/test/resources/**/*.txt - **/test-output/**/* - **/git.properties - **/scripts/assets/LoremIpsum.txt - LICENSE - NOTICE - + + + StandardCollection + **/*.yaml + **/*.yml + **/.* + **/_* + **/test/resources/**/*.txt + **/test-output/**/* + **/git.properties + **/doc/** + **/*.sk + LICENSE + NOTICE + **/*.code-workspace + **/scripts/assets/LoremIpsum.txt + @@ -475,17 +480,17 @@ under the License. org.apache.maven.plugins maven-install-plugin - + org.apache.maven.plugins maven-javadoc-plugin - + org.apache.maven.plugins maven-surefire-plugin From 018aab3f1024164940b430df8d595b8f18e5716c Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Tue, 21 Apr 2026 16:08:55 -0700 Subject: [PATCH 22/26] Add tests to ds-memory-java11 subproject. --- datasketches-memory-java11/pom.xml | 67 ++++-- .../internal/AllocateDirectMapMemoryTest.java | 153 +++++++++++++ .../memory/internal/UtilTest.java | 205 ++++++++++++++++++ .../src/test/resources/GettysburgAddress.txt | 7 + datasketches-memory-java8/pom.xml | 5 + pom.xml | 38 ++-- 6 files changed, 439 insertions(+), 36 deletions(-) create mode 100644 datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java create mode 100644 datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java create mode 100644 datasketches-memory-java11/src/test/resources/GettysburgAddress.txt diff --git a/datasketches-memory-java11/pom.xml b/datasketches-memory-java11/pom.xml index ef3194f3..089e2510 100644 --- a/datasketches-memory-java11/pom.xml +++ b/datasketches-memory-java11/pom.xml @@ -35,11 +35,13 @@ under the License. jar + + 7.12.0 11 - 11 + ${java.version} ${java.version} ${java.version} - >true + true true --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED @@ -51,7 +53,37 @@ under the License. + + + org.testng + testng + ${testng.version} + test + + + + net.openhft + zero-allocation-hashing + ${zero-allocation-hashing.version} + test + + + org.apache.datasketches + datasketches-memory-java8 + 3.0.2 + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + + + + org.apache.maven.plugins @@ -61,12 +93,26 @@ under the License. ${arg.jdk.internal.ref} ${arg.jdk.internal.misc} - ${arg.java.nio} - ${arg.sun.nio.ch} + + + org.apache.maven.plugins + maven-surefire-plugin + + + @{argLine} @{jvm.args} + false + false + true + ${project.build.directory}/test-output/${maven.build.timestamp} + false + + + org.apache.maven.plugins maven-toolchains-plugin @@ -93,11 +139,9 @@ under the License. assemble-mr-jar - - !unsetDefaultProfile - + false - + ${project.root}/tools/scripts/package-multi-release-jar.sh ${env.JAVA_HOME} ${project.version} @@ -130,11 +174,4 @@ under the License. - - - org.apache.datasketches - datasketches-memory-java8 - 3.0.2 - - diff --git a/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java new file mode 100644 index 00000000..a4eefc42 --- /dev/null +++ b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java @@ -0,0 +1,153 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Note: Lincoln's Gettysburg Address is in the public domain. See LICENSE. + */ + +package org.apache.datasketches.memory.internal; + +import static org.apache.datasketches.memory.internal.Util.getResourceFile; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.nio.ByteOrder; +import java.nio.charset.StandardCharsets; + +import org.apache.datasketches.memory.Memory; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +public class AllocateDirectMapMemoryTest { + private static final String LS = System.getProperty("line.separator"); + + @BeforeClass + public void setReadOnly() { + UtilTest.setGettysburgAddressFileToReadOnly(); + } + + @Test(expectedExceptions = IllegalStateException.class) + public void simpleMap() throws IOException { + File file = getResourceFile("GettysburgAddress.txt"); + assertTrue(AllocateDirectWritableMap.isFileReadOnly(file)); + try (Memory mem = Memory.map(file)) { + mem.close(); //explicit close + } //The Try-With-Resources will throw if already closed + } + + @Test + public void printGettysbergAddress() throws IOException { + File file = getResourceFile("GettysburgAddress.txt"); + try (Memory mem = Memory.map(file)) + { + int len1 = (int)mem.getCapacity(); + println("Mem Cap: " + len1); + println("Total Offset: " + mem.getRelativeOffset()); + println("Cum Offset: " + ((ResourceImpl)mem).getCumulativeOffset(0)); + println("Total Offset: " + mem.getRelativeOffset()); + byte[] bArr = new byte[len1]; + mem.getByteArray(0, bArr, 0, len1); + String s = new String(bArr, StandardCharsets.UTF_8); + println(s); + + println(""); + Memory mem2 = mem.region(43 + 76, 34); + int len2 = (int)mem2.getCapacity(); + println("Mem Cap: " + len2); + println("Offset: " + mem.getRelativeOffset()); + println("Cum Offset: " + ((ResourceImpl)mem2).getCumulativeOffset(0)); + println("Total Offset: " + mem2.getRelativeOffset()); + byte[] bArr2 = new byte[len2]; + mem2.getByteArray(0, bArr2, 0, len2); + String s2 = new String(bArr2,StandardCharsets.UTF_8); + println(s2); + assertEquals(s2,"a new nation, conceived in Liberty"); + } + } + + @Test + public void testIllegalArguments() throws IOException { + File file = getResourceFile("GettysburgAddress.txt"); + try (Memory mem = Memory.map(file, -1, Integer.MAX_VALUE, ByteOrder.nativeOrder())) { + fail("Failed: Position was negative."); + } catch (IllegalArgumentException e) { + //ok + } + + try (Memory mem = Memory.map(file, 0, -1, ByteOrder.nativeOrder())) { + fail("Failed: Size was negative."); + } catch (IllegalArgumentException e) { + //ok + } + } + + @Test(expectedExceptions = IllegalStateException.class) + public void testAccessAfterClose() throws IOException { + File file = getResourceFile("GettysburgAddress.txt"); + long memCapacity = file.length(); + try (Memory mem = Memory.map(file, 0, memCapacity, ByteOrder.nativeOrder())) { + assertEquals(memCapacity, mem.getCapacity()); + } //normal close via TWR + Memory mem = Memory.map(file, 0, memCapacity, ByteOrder.nativeOrder()); + mem.close(); //normal manual close + mem.getCapacity(); //isLoaded(); //already closed, invalid + } + + @Test(expectedExceptions = IllegalStateException.class) + public void testReadFailAfterClose() throws IOException { + File file = getResourceFile("GettysburgAddress.txt"); + long memCapacity = file.length(); + Memory mem = Memory.map(file, 0, memCapacity, ByteOrder.nativeOrder()); + mem.close(); + mem.isLoaded(); + } + + @Test + public void testLoad() throws IOException { + File file = getResourceFile("GettysburgAddress.txt"); + long memCapacity = file.length(); + try (Memory mem = Memory.map(file, 0, memCapacity, ByteOrder.nativeOrder())) { + mem.load(); + assertTrue(mem.isLoaded()); + } //normal TWR close + } + + @Test + public void printlnTest() { + println("PRINTING: " + this.getClass().getName()); + } + + static void println(final Object o) { + if (o == null) { print(LS); } + else { print(o.toString() + LS); } + } + + /** + * @param o value to print + */ + static void print(final Object o) { + if (o != null) { + //System.out.print(o.toString()); //disable here + } + } + +} diff --git a/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java new file mode 100644 index 00000000..14a8629c --- /dev/null +++ b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java @@ -0,0 +1,205 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +/* + * Note: Lincoln's Gettysburg Address is in the public domain. See LICENSE. + */ + +package org.apache.datasketches.memory.internal; + +import static org.apache.datasketches.memory.internal.Util.characterPad; +import static org.apache.datasketches.memory.internal.Util.getResourceBytes; +import static org.apache.datasketches.memory.internal.Util.getResourceFile; +import static org.apache.datasketches.memory.internal.Util.negativeCheck; +import static org.apache.datasketches.memory.internal.Util.nullCheck; +import static org.apache.datasketches.memory.internal.Util.zeroCheck; +import static org.apache.datasketches.memory.internal.Util.zeroPad; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.LinkOption; +import java.nio.file.attribute.PosixFileAttributeView; +import java.nio.file.attribute.PosixFileAttributes; +import java.nio.file.attribute.PosixFilePermissions; + +import org.apache.datasketches.memory.MemoryBoundsException; +import org.apache.datasketches.memory.WritableMemory; +import org.testng.annotations.Test; + +public class UtilTest { + private static final String LS = System.getProperty("line.separator"); + + //Binary Search + @Test + public void checkBinarySearch() { + int k = 1024; //longs + WritableMemory wMem = WritableMemory.allocate(k << 3); //1024 longs + for (int i = 0; i < k; i++) { wMem.putLong(i << 3, i); } + long idx = Util.binarySearchLongs(wMem, 0, k - 1, k / 2); + long val = wMem.getLong(idx << 3); + assertEquals(idx, k / 2); + assertEquals(val, k / 2); + + idx = Util.binarySearchLongs(wMem, 0, k - 1, k); + assertEquals(idx, -1024); + } + + @Test(expectedExceptions = MemoryBoundsException.class) + public void checkBoundsTest() { + ResourceImpl.checkBounds(999, 2, 1000); + } + + @Test + public void checkPadding() { + String s = "123"; + String t = zeroPad(s, 4); + assertTrue(t.startsWith("0")); + + t = characterPad(s, 4, '0', true); + assertTrue(t.endsWith("0")); + + t = characterPad(s, 3, '0', false); + assertEquals(s, t); + } + + @Test + public void checkNullZeroNegativeChecks() { + Object obj = null; + try { + nullCheck(obj, "Test Object"); + fail(); + } catch (IllegalArgumentException e) { + //OK + } + try { + zeroCheck(0, "Test Long"); + fail(); + } catch (IllegalArgumentException e) { + //OK + } + try { + negativeCheck(-1L, "Test Long"); + fail(); + } catch (IllegalArgumentException e) { + //OK + } + } + + @Test + public void checkCodePointArr() { + final Util.RandomCodePoints rvcp = new Util.RandomCodePoints(true); + final int n = 1000; + final int[] cpArr = new int[n]; + rvcp.fillCodePointArray(cpArr); + for (int i = 0; i < n; i++) { + int cp = cpArr[i]; + if ((cp >= Character.MIN_SURROGATE) && (cp <= Character.MAX_SURROGATE)) { + fail(); + } + } + } + + @Test + public void checkCodePoint() { + final Util.RandomCodePoints rvcp = new Util.RandomCodePoints(true); + final int n = 1000; + for (int i = 0; i < n; i++) { + int cp = rvcp.getCodePoint(); + if ((cp >= Character.MIN_SURROGATE) && (cp <= Character.MAX_SURROGATE)) { + fail(); + } + } + } + + static final String getFileAttributes(File file) { + try { + PosixFileAttributes attrs = Files.getFileAttributeView( + file.toPath(), PosixFileAttributeView.class, new LinkOption[0]).readAttributes(); + String s = String.format("%s: %s %s %s%n", + file.getPath(), + attrs.owner().getName(), + attrs.group().getName(), + PosixFilePermissions.toString(attrs.permissions())); + return s; + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + static final void setGettysburgAddressFileToReadOnly() { + File file = getResourceFile("GettysburgAddress.txt"); + try { + Files.setPosixFilePermissions(file.toPath(), PosixFilePermissions.fromString("r--r--r--")); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + + //Resources + + @Test + public void resourceFileExits() { + final String shortFileName = "GettysburgAddress.txt"; + final File file = getResourceFile(shortFileName); + assertTrue(file.exists()); + } + + @Test(expectedExceptions = NullPointerException.class) + public void resourceFileNotFound() { + final String shortFileName = "GettysburgAddress.txt"; + getResourceFile(shortFileName + "123"); + } + + @Test + public void resourceBytesCorrect() { + final String shortFileName = "GettysburgAddress.txt"; + final byte[] bytes = getResourceBytes(shortFileName); + assertTrue(bytes.length == 1541); + } + + @Test(expectedExceptions = NullPointerException.class) + public void resourceBytesFileNotFound() { + final String shortFileName = "GettysburgAddress.txt"; + getResourceBytes(shortFileName + "123"); + } + + @Test + public void printlnTest() { + println("PRINTING: " + this.getClass().getName()); + } + + static void println(final Object o) { + if (o == null) { print(LS); } + else { print(o.toString() + LS); } + } + + /** + * @param o value to print + */ + static void print(final Object o) { + if (o != null) { + //System.out.print(o.toString()); //disable here + } + } + +} diff --git a/datasketches-memory-java11/src/test/resources/GettysburgAddress.txt b/datasketches-memory-java11/src/test/resources/GettysburgAddress.txt new file mode 100644 index 00000000..3969d176 --- /dev/null +++ b/datasketches-memory-java11/src/test/resources/GettysburgAddress.txt @@ -0,0 +1,7 @@ +Abraham Lincoln's Gettysburg Address: + + Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal. + + Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this. + + But, in a larger sense, we can not dedicate —- we can not consecrate —- we can not hallow —- this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us -— that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion -— that we here highly resolve that these dead shall not have died in vain -— that this nation, under God, shall have a new birth of freedom -— and that government of the people, by the people, for the people, shall not perish from the earth. diff --git a/datasketches-memory-java8/pom.xml b/datasketches-memory-java8/pom.xml index a172652e..9dbdc770 100644 --- a/datasketches-memory-java8/pom.xml +++ b/datasketches-memory-java8/pom.xml @@ -35,7 +35,10 @@ under the License. jar + + 7.5.1 8 + ${java.version} ${java.version} ${java.version} @@ -46,12 +49,14 @@ under the License. org.testng testng + ${testng.version} test net.openhft zero-allocation-hashing + ${zero-allocation-hashing.version} test diff --git a/pom.xml b/pom.xml index 511bd7d5..37af144c 100644 --- a/pom.xml +++ b/pom.xml @@ -96,8 +96,6 @@ under the License. - - 7.5.1 3.9.12 @@ -125,7 +123,7 @@ under the License. 3.2.8 3.1.4 3.4.2 - 3.12.0 + 3.11.2 3.3.1 3.4.0 3.5.4 @@ -181,7 +179,7 @@ under the License. - + + + net.openhft zero-allocation-hashing ${zero-allocation-hashing.version} @@ -199,7 +196,7 @@ under the License. - +--> @@ -213,13 +210,13 @@ under the License. - org.apache.maven.plugins maven-deploy-plugin ${maven-deploy-plugin.version} ---> + org.apache.maven.plugins maven-enforcer-plugin @@ -260,7 +257,6 @@ under the License. ${maven-install-plugin.version} - + org.apache.maven.plugins maven-javadoc-plugin @@ -311,13 +307,13 @@ under the License. - org.apache.maven.plugins maven-source-plugin @@ -339,7 +335,7 @@ under the License. ---> + org.apache.maven.plugins maven-surefire-plugin @@ -465,12 +461,12 @@ under the License. org.apache.maven.plugins maven-compiler-plugin - + org.apache.maven.plugins maven-enforcer-plugin @@ -480,12 +476,12 @@ under the License. org.apache.maven.plugins maven-install-plugin - + org.apache.maven.plugins maven-javadoc-plugin @@ -495,12 +491,12 @@ under the License. org.apache.maven.plugins maven-release-plugin - +--> org.apache.maven.plugins maven-source-plugin ---> + org.apache.maven.plugins maven-surefire-plugin From 4c7e780070be3325c13e0b30010da92de5b00103 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Thu, 23 Apr 2026 14:58:58 -0700 Subject: [PATCH 23/26] Updates for a clean console output. --- datasketches-memory-java11/pom.xml | 17 ++++-- datasketches-memory-java8/pom.xml | 29 +++------ datasketches-memory-report/pom.xml | 95 ++++++++++++++++++++++++++++++ pom.xml | 38 ++++-------- 4 files changed, 125 insertions(+), 54 deletions(-) create mode 100644 datasketches-memory-report/pom.xml diff --git a/datasketches-memory-java11/pom.xml b/datasketches-memory-java11/pom.xml index 089e2510..3195aee9 100644 --- a/datasketches-memory-java11/pom.xml +++ b/datasketches-memory-java11/pom.xml @@ -28,6 +28,7 @@ under the License. org.apache.datasketches datasketches-memory 3.0.2 + ../pom.xml datasketches-memory-java11 @@ -48,9 +49,9 @@ under the License. --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED - + --add-opens=java.base/java.nio=ALL-UNNAMED - + --add-opens=java.base/sun.nio.ch=ALL-UNNAMED @@ -93,18 +94,22 @@ under the License. ${arg.jdk.internal.ref} ${arg.jdk.internal.misc} - org.apache.maven.plugins - maven-surefire-plugin + maven-jar-plugin + + + org.apache.maven.plugins + maven-surefire-plugin - @{argLine} @{jvm.args} + + @{argLine} @{jvm.args} ${arg.java.nio} ${arg.sun.nio.ch} ${arg.jdk.internal.misc} ${arg.jdk.internal.ref} + false false true diff --git a/datasketches-memory-java8/pom.xml b/datasketches-memory-java8/pom.xml index 9dbdc770..0e415bb6 100644 --- a/datasketches-memory-java8/pom.xml +++ b/datasketches-memory-java8/pom.xml @@ -28,6 +28,7 @@ under the License. org.apache.datasketches datasketches-memory 3.0.2 + ../pom.xml datasketches-memory-java8 @@ -60,26 +61,14 @@ under the License. test - + diff --git a/datasketches-memory-report/pom.xml b/datasketches-memory-report/pom.xml new file mode 100644 index 00000000..8409abfa --- /dev/null +++ b/datasketches-memory-report/pom.xml @@ -0,0 +1,95 @@ + + + + + 4.0.0 + + + org.apache.datasketches + datasketches-memory + 3.0.2 + ../pom.xml + + + datasketches-memory-report + ${project.artifactId} + pom + + + 11 + + + + + org.apache.datasketches + datasketches-memory-java8 + ${project.version} + + + org.apache.datasketches + datasketches-memory-java11 + ${project.version} + + + + + + + org.apache.maven.plugins + maven-toolchains-plugin + + + + toolchain + + + + + + + ${java.version} + + + + + + org.jacoco + jacoco-maven-plugin + + + report-aggregate + verify + + report-aggregate + + + + + + org/apache/datasketches/memory/internal/VirtualMachineMemory.class + + + + + + diff --git a/pom.xml b/pom.xml index 37af144c..dbe4eb15 100644 --- a/pom.xml +++ b/pom.xml @@ -130,7 +130,7 @@ under the License. 3.2.0 - 0.17 + 0.18 @@ -179,24 +179,7 @@ under the License. - + @@ -210,12 +193,12 @@ under the License. - + org.apache.maven.plugins @@ -288,6 +271,7 @@ under the License. true public none + true -J${jvm.mem} -J${jvm.locale.language} @@ -374,6 +358,7 @@ under the License. org.apache.rat apache-rat-plugin ${apache-rat-plugin.version} + false verify @@ -383,6 +368,7 @@ under the License. + false ${project.basedir}/rat true @@ -414,7 +400,7 @@ under the License. ${coveralls-repo-token} - ${session.rootDirectory}/datasketches-memory-java8/target/site/jacoco/jacoco.xml + ${project.basedir}/datasketches-memory-report/target/site/jacoco-aggregate/jacoco.xml @@ -425,7 +411,7 @@ under the License. - + org.jacoco jacoco-maven-plugin ${jacoco-maven-plugin.version} @@ -477,11 +463,6 @@ under the License. maven-install-plugin - - org.apache.maven.plugins - maven-jar-plugin - - org.apache.maven.plugins maven-javadoc-plugin @@ -542,6 +523,7 @@ under the License. datasketches-memory-java8 datasketches-memory-java11 + datasketches-memory-report From 6b370b9d8aa202bf30789b3439f68a6a2c50d371 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Thu, 23 Apr 2026 15:16:06 -0700 Subject: [PATCH 24/26] update .mvn/maven.config --- .mvn/maven.config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.mvn/maven.config b/.mvn/maven.config index db5ce585..bd0d7511 100644 --- a/.mvn/maven.config +++ b/.mvn/maven.config @@ -4,3 +4,6 @@ # To disable these warnings, set -Dmaven.project.sourceRoots.warningsDisabled=true on the command line or in the .mvn/maven.config file. -Dmaven.project.sourceRoots.warningsDisabled=true -Dproject.root=${session.rootDirectory} +--no-transfer-progress +--batch-mode +-Dstyle.color=always \ No newline at end of file From 59a0db2ffed8280bb7259862a91bdb1296c4ca81 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Fri, 24 Apr 2026 09:31:11 -0700 Subject: [PATCH 25/26] bypass setReadOnly on Windows --- .../memory/internal/AllocateDirectMapMemoryTest.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java index a4eefc42..aac1142f 100644 --- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java +++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java @@ -38,10 +38,14 @@ import org.testng.annotations.Test; public class AllocateDirectMapMemoryTest { + private static final String LS = System.getProperty("line.separator"); @BeforeClass public void setReadOnly() { + if (System.getProperty("os.name").startsWith("Windows")) { + return; // Or force unmap or skip the toggle-in-place test for Windows + } UtilTest.setGettysburgAddressFileToReadOnly(); } From 84d8bcabb55b3e1964e3a4e9520fd6c3de449b59 Mon Sep 17 00:00:00 2001 From: Lee Rhodes Date: Tue, 28 Apr 2026 12:39:31 -0700 Subject: [PATCH 26/26] Remove support for Java 8. --- datasketches-memory-java11/pom.xml | 40 ++-- .../apache/datasketches/memory/Buffer.java | 0 .../BufferPositionInvariantsException.java | 0 .../memory/DefaultMemoryRequestServer.java | 0 .../apache/datasketches/memory/Memory.java | 0 .../memory/MemoryBoundsException.java | 0 .../memory/MemoryRequestServer.java | 0 .../datasketches/memory/MurmurHash3v2.java | 2 +- .../datasketches/memory/Positional.java | 0 .../memory/ReadOnlyException.java | 0 .../apache/datasketches/memory/Resource.java | 0 .../datasketches/memory/WritableBuffer.java | 0 .../datasketches/memory/WritableMemory.java | 0 .../apache/datasketches/memory/XxHash.java | 0 .../memory/internal/AccessByteBuffer.java | 2 +- .../memory/internal/AllocateDirect.java | 2 +- .../internal/AllocateDirectWritableMap.java | 2 +- .../BBNonNativeWritableBufferImpl.java | 0 .../BBNonNativeWritableMemoryImpl.java | 0 .../memory/internal/BBWritableBufferImpl.java | 0 .../memory/internal/BBWritableMemoryImpl.java | 0 .../internal/BaseWritableBufferImpl.java | 2 +- .../internal/BaseWritableMemoryImpl.java | 2 +- .../memory/internal/CompareAndCopy.java | 2 +- .../DirectNonNativeWritableBufferImpl.java | 0 .../DirectNonNativeWritableMemoryImpl.java | 0 .../internal/DirectWritableBufferImpl.java | 0 .../internal/DirectWritableMemoryImpl.java | 0 .../HeapNonNativeWritableBufferImpl.java | 0 .../HeapNonNativeWritableMemoryImpl.java | 0 .../internal/HeapWritableBufferImpl.java | 0 .../internal/HeapWritableMemoryImpl.java | 0 .../datasketches/memory/internal/Ints.java | 0 .../MapNonNativeWritableBufferImpl.java | 0 .../MapNonNativeWritableMemoryImpl.java | 0 .../internal/MapWritableBufferImpl.java | 0 .../internal/MapWritableMemoryImpl.java | 0 .../internal/NativeWritableBufferImpl.java | 2 +- .../internal/NativeWritableMemoryImpl.java | 2 +- .../internal/NonNativeWritableBufferImpl.java | 2 +- .../internal/NonNativeWritableMemoryImpl.java | 2 +- .../memory/internal/PositionalImpl.java | 0 .../datasketches/memory/internal/Prim.java | 2 +- .../memory/internal/ResourceImpl.java | 2 +- .../memory/internal/StepBoolean.java | 0 .../memory/internal/UnsafeUtil.java | 2 +- .../datasketches/memory/internal/Util.java | 79 ++++++- .../memory/internal/XxHash64.java | 2 +- .../internal/AllocateDirectMapMemoryTest.java | 2 +- .../internal/AllocateDirectMemoryTest.java | 0 .../AllocateDirectWritableMapMemoryTest.java | 0 .../memory/internal/Buffer2Test.java | 0 .../internal/BufferBoundaryCheckTest.java | 0 .../memory/internal/BufferInvariantsTest.java | 0 .../internal/BufferReadWriteSafetyTest.java | 0 .../memory/internal/BufferTest.java | 0 .../memory/internal/CommonBufferTest.java | 0 .../memory/internal/CommonMemoryTest.java | 0 .../internal/CopyMemoryOverlapTest.java | 0 .../memory/internal/CopyMemoryTest.java | 0 .../memory/internal/DruidIssue11544Test.java | 0 .../ExampleMemoryRequestServerTest.java | 0 .../internal/IgnoredArrayOverflowTest.java | 0 .../memory/internal/LeafImplTest.java | 0 .../internal/MemoryBoundaryCheckTest.java | 0 .../memory/internal/MemoryCleanerTest.java | 0 .../internal/MemoryCloseExceptionTest.java | 0 .../internal/MemoryReadWriteSafetyTest.java | 0 .../memory/internal/MemoryTest.java | 0 .../memory/internal/MemoryWriteToTest.java | 0 .../NativeWritableBufferImplTest.java | 0 .../NativeWritableMemoryImplTest.java | 0 .../NonNativeWritableBufferImplTest.java | 0 .../NonNativeWritableMemoryImplTest.java | 0 .../memory/internal/PositionalTest.java | 0 .../memory/internal/ResourceTest.java | 0 .../memory/internal/SpecificLeafTest.java | 0 .../memory/internal/ThreadTest.java | 0 .../memory/internal/UnsafeUtilTest.java | 2 +- .../memory/internal/UtilTest.java | 8 +- .../internal/VirtualMachineMemoryTest.java | 0 .../internal/WritableDirectCopyTest.java | 0 .../memory/internal/WritableMemoryTest.java | 0 .../memory/internal/XxHash64LoopingTest.java | 0 .../memory/internal/XxHash64Test.java | 0 .../memory/internal/ZeroCapacityTest.java | 0 datasketches-memory-java8/pom.xml | 74 ------- .../datasketches/memory/MemoryException.java | 42 ---- .../memory/internal/MemoryCleaner.java | 51 ----- .../memory/internal/VirtualMachineMemory.java | 56 ----- .../memory/internal/package-info.java | 23 -- .../datasketches/memory/package-info.java | 122 ----------- .../src/main/javadoc/overview.html | 34 --- .../internal/AllocateDirectMapMemoryTest.java | 157 -------------- .../memory/internal/UtilTest.java | 205 ------------------ .../src/test/resources/GettysburgAddress.txt | 7 - datasketches-memory-report/pom.xml | 7 +- pom.xml | 5 +- 98 files changed, 118 insertions(+), 826 deletions(-) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/Buffer.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/BufferPositionInvariantsException.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/DefaultMemoryRequestServer.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/Memory.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/MemoryBoundsException.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/MemoryRequestServer.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/Positional.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/ReadOnlyException.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/Resource.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/WritableBuffer.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/WritableMemory.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/XxHash.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/AccessByteBuffer.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMap.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableBufferImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableMemoryImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/BBWritableBufferImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/BBWritableMemoryImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/CompareAndCopy.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableBufferImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableMemoryImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/DirectWritableBufferImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableBufferImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableMemoryImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/HeapWritableBufferImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/HeapWritableMemoryImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/Ints.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableBufferImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableMemoryImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/MapWritableBufferImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/MapWritableMemoryImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/PositionalImpl.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/Prim.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/StepBoolean.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/UnsafeUtil.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/Util.java (83%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/main/java/org/apache/datasketches/memory/internal/XxHash64.java (99%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMemoryTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMapMemoryTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/BufferBoundaryCheckTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/BufferInvariantsTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/BufferReadWriteSafetyTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/CommonBufferTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/CommonMemoryTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/CopyMemoryOverlapTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/CopyMemoryTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/DruidIssue11544Test.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/ExampleMemoryRequestServerTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/IgnoredArrayOverflowTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/LeafImplTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/MemoryBoundaryCheckTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/MemoryCleanerTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/MemoryCloseExceptionTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/MemoryReadWriteSafetyTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/MemoryWriteToTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/PositionalTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/ResourceTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/ThreadTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/UnsafeUtilTest.java (98%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/VirtualMachineMemoryTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/WritableDirectCopyTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/WritableMemoryTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/XxHash64LoopingTest.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/XxHash64Test.java (100%) rename {datasketches-memory-java8 => datasketches-memory-java11}/src/test/java/org/apache/datasketches/memory/internal/ZeroCapacityTest.java (100%) delete mode 100644 datasketches-memory-java8/pom.xml delete mode 100644 datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java delete mode 100644 datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MemoryCleaner.java delete mode 100644 datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/VirtualMachineMemory.java delete mode 100644 datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/package-info.java delete mode 100644 datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/package-info.java delete mode 100644 datasketches-memory-java8/src/main/javadoc/overview.html delete mode 100644 datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java delete mode 100644 datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java delete mode 100644 datasketches-memory-java8/src/test/resources/GettysburgAddress.txt diff --git a/datasketches-memory-java11/pom.xml b/datasketches-memory-java11/pom.xml index 3195aee9..2a1ce83c 100644 --- a/datasketches-memory-java11/pom.xml +++ b/datasketches-memory-java11/pom.xml @@ -39,19 +39,23 @@ under the License. 7.12.0 11 + ${java.version} ${java.version} ${java.version} - true + false true --add-exports=java.base/jdk.internal.misc=ALL-UNNAMED --add-exports=java.base/jdk.internal.ref=ALL-UNNAMED + + --add-exports=java.base/sun.nio.ch=ALL-UNNAMED + + --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.nio=ALL-UNNAMED - - --add-opens=java.base/sun.nio.ch=ALL-UNNAMED + @@ -69,21 +73,22 @@ under the License. test - org.apache.datasketches - datasketches-memory-java8 - 3.0.2 + org.slf4j + slf4j-simple + ${org-slf4j.version} + test - - - - org.apache.maven.plugins - maven-deploy-plugin - - - + + + + org.apache.maven.plugins + maven-deploy-plugin + + + @@ -94,6 +99,8 @@ under the License. ${arg.jdk.internal.ref} ${arg.jdk.internal.misc} + ${arg.sun.nio.ch.exports} + ${arg.sun.nio.ch.opens} @@ -108,11 +115,12 @@ under the License. maven-surefire-plugin - @{argLine} @{jvm.args} ${arg.java.nio} ${arg.sun.nio.ch} ${arg.jdk.internal.misc} ${arg.jdk.internal.ref} + @{argLine} @{jvm.args} ${arg.java.nio} ${arg.sun.nio.ch.exports} ${arg.sun.nio.ch.opens} ${arg.jdk.internal.misc} ${arg.jdk.internal.ref} false + false false - true + false ${project.build.directory}/test-output/${maven.build.timestamp} false diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/Buffer.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/Buffer.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BufferPositionInvariantsException.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/BufferPositionInvariantsException.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BufferPositionInvariantsException.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/BufferPositionInvariantsException.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/DefaultMemoryRequestServer.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/DefaultMemoryRequestServer.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/DefaultMemoryRequestServer.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/DefaultMemoryRequestServer.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/Memory.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Memory.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/Memory.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryBoundsException.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/MemoryBoundsException.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryBoundsException.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/MemoryBoundsException.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryRequestServer.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/MemoryRequestServer.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryRequestServer.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/MemoryRequestServer.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java index 50be79f0..916494f8 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java @@ -184,7 +184,7 @@ public static long[] hash( * @param hashOut the size 2 long array for the resulting 128-bit hash * @return the hash. */ - @SuppressWarnings("restriction") + //@SuppressWarnings("restriction") public static long[] hash( final Memory mem, final long offsetBytes, diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Positional.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/Positional.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Positional.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/Positional.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/ReadOnlyException.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/ReadOnlyException.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/ReadOnlyException.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/ReadOnlyException.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Resource.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/Resource.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Resource.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/Resource.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableBuffer.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/WritableBuffer.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableBuffer.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/WritableBuffer.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/WritableMemory.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/WritableMemory.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/XxHash.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/XxHash.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/XxHash.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/XxHash.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AccessByteBuffer.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/AccessByteBuffer.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AccessByteBuffer.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/AccessByteBuffer.java index 9319e820..f0a05901 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AccessByteBuffer.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/AccessByteBuffer.java @@ -31,7 +31,7 @@ * @author Praveenkumar Venkatesan * @author Roman Leventov */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") final class AccessByteBuffer { static final ByteBuffer ZERO_READ_ONLY_DIRECT_BYTE_BUFFER = diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java index 02110611..6db389c8 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/AllocateDirect.java @@ -29,7 +29,7 @@ * @author Roman Leventov * @author Lee Rhodes */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") final class AllocateDirect { static final Logger LOG = Logger.getLogger(AllocateDirect.class.getCanonicalName()); diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMap.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMap.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMap.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMap.java index f461c6f6..eacf63b8 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMap.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMap.java @@ -49,7 +49,7 @@ * @author Lee Rhodes * @author Praveenkumar Venkatesan */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") final class AllocateDirectWritableMap { static final Logger LOG = Logger.getLogger(AllocateDirectWritableMap.class.getCanonicalName()); diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableBufferImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableBufferImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableBufferImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableBufferImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableMemoryImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableMemoryImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableMemoryImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BBNonNativeWritableMemoryImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableBufferImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BBWritableBufferImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableBufferImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BBWritableBufferImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableMemoryImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BBWritableMemoryImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BBWritableMemoryImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BBWritableMemoryImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java index 86fbe032..106f004b 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java @@ -43,7 +43,7 @@ * Common base of native-ordered and non-native-ordered {@link WritableBuffer} implementations. * Contains methods which are agnostic to the byte order. */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") public abstract class BaseWritableBufferImpl extends PositionalImpl implements WritableBuffer { //Pass-through constructor diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java index 5bee6e75..2bd6971d 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/BaseWritableMemoryImpl.java @@ -47,7 +47,7 @@ * Common base of native-ordered and non-native-ordered {@link WritableMemory} implementations. * Contains methods which are agnostic to the byte order. */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") public abstract class BaseWritableMemoryImpl extends ResourceImpl implements WritableMemory { //1KB of empty bytes for speedy clear() diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/CompareAndCopy.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/CompareAndCopy.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/CompareAndCopy.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/CompareAndCopy.java index 052b84e5..a3ef00f5 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/CompareAndCopy.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/CompareAndCopy.java @@ -31,7 +31,7 @@ /** * @author Lee Rhodes */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") final class CompareAndCopy { private CompareAndCopy() { } diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableBufferImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableBufferImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableBufferImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableBufferImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableMemoryImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableMemoryImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableMemoryImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/DirectNonNativeWritableMemoryImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableBufferImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/DirectWritableBufferImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableBufferImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/DirectWritableBufferImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/DirectWritableMemoryImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableBufferImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableBufferImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableBufferImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableBufferImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableMemoryImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableMemoryImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableMemoryImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/HeapNonNativeWritableMemoryImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableBufferImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/HeapWritableBufferImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableBufferImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/HeapWritableBufferImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableMemoryImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/HeapWritableMemoryImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/HeapWritableMemoryImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/HeapWritableMemoryImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Ints.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Ints.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Ints.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Ints.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableBufferImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableBufferImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableBufferImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableBufferImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableMemoryImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableMemoryImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableMemoryImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/MapNonNativeWritableMemoryImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableBufferImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/MapWritableBufferImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableBufferImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/MapWritableBufferImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableMemoryImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/MapWritableMemoryImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MapWritableMemoryImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/MapWritableMemoryImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java index f092bb3b..d5be892a 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NativeWritableBufferImpl.java @@ -36,7 +36,7 @@ * @author Roman Leventov * @author Lee Rhodes */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") abstract class NativeWritableBufferImpl extends BaseWritableBufferImpl { //Pass-through constructor diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java index 922a62d0..198fbe06 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImpl.java @@ -36,7 +36,7 @@ * @author Roman Leventov * @author Lee Rhodes */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") abstract class NativeWritableMemoryImpl extends BaseWritableMemoryImpl { //Pass-through constructor diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java index 8202ebff..f16c57c3 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImpl.java @@ -30,7 +30,7 @@ * @author Roman Leventov * @author Lee Rhodes */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") abstract class NonNativeWritableBufferImpl extends BaseWritableBufferImpl { //Pass-through constructor diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java index 8597ce5a..bc94ecff 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImpl.java @@ -30,7 +30,7 @@ * @author Roman Leventov * @author Lee Rhodes */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") abstract class NonNativeWritableMemoryImpl extends BaseWritableMemoryImpl { //Pass-through constructor diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/PositionalImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/PositionalImpl.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/PositionalImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/PositionalImpl.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Prim.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Prim.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Prim.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Prim.java index 96d82031..0caffb31 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Prim.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Prim.java @@ -52,7 +52,7 @@ * * @author Lee Rhodes */ -@SuppressWarnings("javadoc") +//@SuppressWarnings("javadoc") public enum Prim { BOOLEAN(ARRAY_BOOLEAN_BASE_OFFSET, ARRAY_BOOLEAN_INDEX_SCALE, BOOLEAN_SHIFT), BYTE(ARRAY_BYTE_BASE_OFFSET, ARRAY_BYTE_INDEX_SCALE, BYTE_SHIFT), diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java index d38fdf2a..5eaf3915 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/ResourceImpl.java @@ -35,7 +35,7 @@ * * @author Lee Rhodes */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") public abstract class ResourceImpl implements Resource { static final String JDK; static final int JDK_MAJOR; //8, 11, 17, etc diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/StepBoolean.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/StepBoolean.java similarity index 100% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/StepBoolean.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/StepBoolean.java diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/UnsafeUtil.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/UnsafeUtil.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/UnsafeUtil.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/UnsafeUtil.java index 7f2481d5..8c4d1fa9 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/UnsafeUtil.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/UnsafeUtil.java @@ -29,7 +29,7 @@ * * @author Lee Rhodes */ -@SuppressWarnings({"restriction","javadoc"}) +//@SuppressWarnings({"restriction","javadoc"}) public final class UnsafeUtil { public static final Unsafe unsafe; diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Util.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Util.java similarity index 83% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Util.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Util.java index d94e3d66..7c4f947a 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/Util.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/Util.java @@ -23,12 +23,15 @@ import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import java.nio.ByteOrder; import java.nio.file.Files; +import java.nio.file.Path; import java.nio.file.Paths; +import java.nio.file.StandardCopyOption; import java.util.Objects; import java.util.Random; @@ -318,7 +321,7 @@ public static final void nullCheck(final Object obj, final String arg) { //Resources NOTE: these 3 methods are duplicated in Java/ datasketches/Util /** - * Gets the absolute path of the given resource file's shortName. + * Gets the Path of the given resource file's shortName. * *

Note that the ClassLoader.getResource(shortName) returns a URL, * which can have special characters, e.g., "%20" for spaces. This method @@ -336,21 +339,21 @@ public static String getResourcePath(final String shortFileName) { Objects.requireNonNull(url, "resource " + shortFileName + " could not be acquired."); final URI uri = url.toURI(); //decodes any special characters - final String path = uri.isAbsolute() ? Paths.get(uri).toAbsolutePath().toString() : uri.getPath(); - return path; + final String pathStr = uri.isAbsolute() ? Paths.get(uri).toAbsolutePath().toString() : uri.getPath(); + return pathStr; } catch (final URISyntaxException e) { throw new IllegalArgumentException("Cannot find resource: " + shortFileName + LS + e); } } - /** - * Gets the file defined by the given resource file's shortFileName. - * @param shortFileName the last name in the pathname's name sequence. - * @return the file defined by the given resource file's shortFileName. - */ - public static File getResourceFile(final String shortFileName) { - return new File(getResourcePath(shortFileName)); - } +// /** +// * Gets the file defined by the given resource file's shortFileName. +// * @param shortFileName the last name in the pathname's name sequence. +// * @return the file defined by the given resource file's shortFileName. +// */ +// public static File getResourceFile(final String shortFileName) { +// return new File(getResourcePath(shortFileName)); +// } /** * Returns a byte array of the contents of the file defined by the given resource file's @@ -367,4 +370,58 @@ public static byte[] getResourceBytes(final String shortFileName) { } } + public static void ensureReadOnly(Path path) { + if (!Files.exists(path)) { + throw new IllegalArgumentException("File not found."); + } + + // Works on Windows and POSIX) + path.toFile().setReadOnly(); + } + + /** + * Windows and JAR friendly get Resource File + * @param resourceName the simple file name. No special characters or slashes. + * @return a File System File + */ + public static File getResourceFile(String resourceName) { + Objects.requireNonNull(resourceName, "Given resourceName must not be null"); + if (resourceName.isEmpty()) { throw new IllegalArgumentException("Given resourceName must not be empty"); } + // Normalize name: ClassLoaders MUST use forward slashes even on Windows + String normalizedName = resourceName.replace('\\', '/'); + if (normalizedName.startsWith("/")) { normalizedName = normalizedName.substring(1); } + + ClassLoader loader = Util.class.getClassLoader(); + URL url = loader.getResource(normalizedName); + if (url == null) { throw new IllegalArgumentException("Resource not found: " + normalizedName); } + + // If it's a real file, return it directly + if ("file".equals(url.getProtocol())) { + try { + URI uri = url.toURI(); + return new File(uri); } + catch (URISyntaxException e) { return new File(url.getPath()); } + } + + // If it's in a JAR, we must extract it for Memory.map() to work + // We use a prefix that won't collide with Windows reserved names + File tempFile; + try { tempFile = File.createTempFile("datasketches-", ".bin"); } + catch (IOException e1) { throw new IllegalArgumentException(e1); } + tempFile.deleteOnExit(); + + try (InputStream in = loader.getResourceAsStream(normalizedName)) { + if (in == null) throw new IllegalArgumentException("Could not open stream for " + normalizedName); + + // Use REPLACE_EXISTING to avoid "File Already Exists" errors on Windows retries + Files.copy(in, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING); + } catch (IOException e) { throw new IllegalArgumentException(e); } + + // Final Windows Fix: Ensure the file is actually writable if you need to setReadOnly later + //tempFile.setWritable(true); + + return tempFile; + } + + } diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/XxHash64.java b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/XxHash64.java similarity index 99% rename from datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/XxHash64.java rename to datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/XxHash64.java index c4c8afb7..2071b116 100644 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/XxHash64.java +++ b/datasketches-memory-java11/src/main/java/org/apache/datasketches/memory/internal/XxHash64.java @@ -52,7 +52,7 @@ * * @author Lee Rhodes */ -@SuppressWarnings("restriction") +//@SuppressWarnings("restriction") public class XxHash64 { // Unsigned, 64-bit primes private static final long P1 = -7046029288634856825L; diff --git a/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java index a4eefc42..ec4c2d46 100644 --- a/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java +++ b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java @@ -55,7 +55,7 @@ public void simpleMap() throws IOException { } @Test - public void printGettysbergAddress() throws IOException { + public void printGettysburgAddress() throws IOException { File file = getResourceFile("GettysburgAddress.txt"); try (Memory mem = Memory.map(file)) { diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMemoryTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMemoryTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMemoryTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMemoryTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMapMemoryTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMapMemoryTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMapMemoryTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMapMemoryTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferBoundaryCheckTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/BufferBoundaryCheckTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferBoundaryCheckTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/BufferBoundaryCheckTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferInvariantsTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/BufferInvariantsTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferInvariantsTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/BufferInvariantsTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferReadWriteSafetyTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/BufferReadWriteSafetyTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferReadWriteSafetyTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/BufferReadWriteSafetyTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonBufferTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/CommonBufferTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonBufferTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/CommonBufferTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonMemoryTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/CommonMemoryTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CommonMemoryTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/CommonMemoryTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CopyMemoryOverlapTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/CopyMemoryOverlapTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CopyMemoryOverlapTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/CopyMemoryOverlapTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CopyMemoryTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/CopyMemoryTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/CopyMemoryTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/CopyMemoryTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/DruidIssue11544Test.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/DruidIssue11544Test.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/DruidIssue11544Test.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/DruidIssue11544Test.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ExampleMemoryRequestServerTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/ExampleMemoryRequestServerTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ExampleMemoryRequestServerTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/ExampleMemoryRequestServerTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/IgnoredArrayOverflowTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/IgnoredArrayOverflowTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/IgnoredArrayOverflowTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/IgnoredArrayOverflowTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/LeafImplTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/LeafImplTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/LeafImplTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/LeafImplTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryBoundaryCheckTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryBoundaryCheckTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryBoundaryCheckTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryBoundaryCheckTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryCleanerTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryCleanerTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryCleanerTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryCleanerTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryCloseExceptionTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryCloseExceptionTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryCloseExceptionTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryCloseExceptionTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryReadWriteSafetyTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryReadWriteSafetyTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryReadWriteSafetyTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryReadWriteSafetyTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryWriteToTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryWriteToTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryWriteToTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/MemoryWriteToTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/PositionalTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/PositionalTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/PositionalTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/PositionalTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ResourceTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/ResourceTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ResourceTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/ResourceTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/SpecificLeafTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ThreadTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/ThreadTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ThreadTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/ThreadTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/UnsafeUtilTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/UnsafeUtilTest.java similarity index 98% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/UnsafeUtilTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/UnsafeUtilTest.java index 8381e477..cecdbb10 100644 --- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/UnsafeUtilTest.java +++ b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/UnsafeUtilTest.java @@ -51,7 +51,7 @@ public void checkInts() { Ints.checkedCast(1L << 32); } - @SuppressWarnings("restriction") + //@SuppressWarnings("restriction") @Test public void checkArrayBaseOffset() { diff --git a/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java index 14a8629c..0bb9580e 100644 --- a/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java +++ b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java @@ -149,7 +149,7 @@ static final String getFileAttributes(File file) { static final void setGettysburgAddressFileToReadOnly() { File file = getResourceFile("GettysburgAddress.txt"); try { - Files.setPosixFilePermissions(file.toPath(), PosixFilePermissions.fromString("r--r--r--")); + Files.setPosixFilePermissions(file.toPath(), PosixFilePermissions.fromString("r--r--r--")); } catch (IOException e) { throw new RuntimeException(e); } @@ -164,10 +164,12 @@ public void resourceFileExits() { assertTrue(file.exists()); } - @Test(expectedExceptions = NullPointerException.class) + @Test public void resourceFileNotFound() { final String shortFileName = "GettysburgAddress.txt"; - getResourceFile(shortFileName + "123"); + try { getResourceFile(shortFileName + "123"); } + catch (IllegalArgumentException e) { //OK + } } @Test diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/VirtualMachineMemoryTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/VirtualMachineMemoryTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/VirtualMachineMemoryTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/VirtualMachineMemoryTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableDirectCopyTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/WritableDirectCopyTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableDirectCopyTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/WritableDirectCopyTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableMemoryTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/WritableMemoryTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableMemoryTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/WritableMemoryTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/XxHash64LoopingTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/XxHash64LoopingTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/XxHash64LoopingTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/XxHash64LoopingTest.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/XxHash64Test.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/XxHash64Test.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/XxHash64Test.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/XxHash64Test.java diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ZeroCapacityTest.java b/datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/ZeroCapacityTest.java similarity index 100% rename from datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ZeroCapacityTest.java rename to datasketches-memory-java11/src/test/java/org/apache/datasketches/memory/internal/ZeroCapacityTest.java diff --git a/datasketches-memory-java8/pom.xml b/datasketches-memory-java8/pom.xml deleted file mode 100644 index 0e415bb6..00000000 --- a/datasketches-memory-java8/pom.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - 4.0.0 - - - org.apache.datasketches - datasketches-memory - 3.0.2 - ../pom.xml - - - datasketches-memory-java8 - ${project.artifactId} - jar - - - - 7.5.1 - 8 - - ${java.version} - ${java.version} - ${java.version} - false - - - - - org.testng - testng - ${testng.version} - test - - - - net.openhft - zero-allocation-hashing - ${zero-allocation-hashing.version} - test - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - - diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java deleted file mode 100644 index 6b3663ca..00000000 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MemoryException.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.datasketches.memory; - -/** - * Specific RuntimeExceptions for the datasketches-memory component. - * - * @author Lee Rhodes - * - */ -public class MemoryException extends RuntimeException { - private static final long serialVersionUID = 1L; - - /** - * Constructs a new runtime exception with the specified detail message. The cause is not - * initialized, and may subsequently be initialized by a call to - * Throwable.initCause(java.lang.Throwable). - * - * @param message the detail message. The detail message is saved for later retrieval by the - * Throwable.getMessage() method. - */ - public MemoryException(final String message) { - super(message); - } -} diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MemoryCleaner.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MemoryCleaner.java deleted file mode 100644 index c732dfb7..00000000 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/MemoryCleaner.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.datasketches.memory.internal; - -import sun.misc.Cleaner; - -/** - * Extracts a version-dependent reference to the `sun.misc.Cleaner` into - * a standalone class. The package name for Cleaner has changed in - * later versions. If a JDK Toolchain and MR-JAR have been configured, - * the appropriate class will be loaded by the class loader - * depending on the Java version that is used. - */ -@SuppressWarnings("restriction") -public class MemoryCleaner { - private final Cleaner cleaner; - - /** - * Creates a new `sun.misc.Cleaner`. - * @param referent the object to be cleaned - * @param deallocator - the cleanup code to be run when the cleaner is invoked. - * return MemoryCleaner - */ - public MemoryCleaner(final Object referent, final Runnable deallocator) { - cleaner = Cleaner.create(referent, deallocator); - } - - /** - * Runs this cleaner, if it has not been run before. - */ - public void clean() { - cleaner.clean(); - } -} diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/VirtualMachineMemory.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/VirtualMachineMemory.java deleted file mode 100644 index 83952916..00000000 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/VirtualMachineMemory.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.datasketches.memory.internal; - -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; - -/** - * Extracts a version-dependent reference to the `sun.misc.VM` into a standalone - * class. The package name for VM has changed in later versions. The appropriate - * class will be loaded by the class loader depending on the Java version that is used. - * For more information, see: https://openjdk.java.net/jeps/238 - */ -public final class VirtualMachineMemory { - - private static final Class VM_CLASS; - private static final Method VM_IS_DIRECT_MEMORY_PAGE_ALIGNED_METHOD; - private static final boolean isPageAligned; - - static { - try { - VM_CLASS = Class.forName("sun.misc.VM"); - VM_IS_DIRECT_MEMORY_PAGE_ALIGNED_METHOD = VM_CLASS.getDeclaredMethod("isDirectMemoryPageAligned"); - VM_IS_DIRECT_MEMORY_PAGE_ALIGNED_METHOD.setAccessible(true); - isPageAligned = (boolean) VM_IS_DIRECT_MEMORY_PAGE_ALIGNED_METHOD.invoke(null); // static method - } catch (final ClassNotFoundException | NoSuchMethodException | IllegalAccessException - | IllegalArgumentException | InvocationTargetException | SecurityException e) { - throw new RuntimeException("Could not acquire sun.misc.VM class: " + e.getClass()); - } - } - - /** - * Returns true if the direct buffers should be page aligned. - * @return flag that determines whether direct buffers should be page aligned. - */ - public static boolean getIsPageAligned() { - return isPageAligned; - } -} diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/package-info.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/package-info.java deleted file mode 100644 index 9e557cbd..00000000 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * @author Lee Rhodes - */ -package org.apache.datasketches.memory.internal; 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 deleted file mode 100644 index 1bf43737..00000000 --- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/package-info.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/** - * 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}. - * - *

In addition, this package provides:

- * - *
  • Two different access APIs: read-only {@link org.apache.datasketches.memory.Memory} and - * {@link org.apache.datasketches.memory.WritableMemory} for absolute offset access, - * and read-only {@link org.apache.datasketches.memory.Buffer} and - * {@link org.apache.datasketches.memory.WritableBuffer} - * for relative positional access (similar to ByteBuffer).
  • - * - *
  • Clean separation of Read-only API from Writable API, which makes writable versus read-only - * resources detectable at compile time.
  • - * - *
  • The conversion from Writable to read-only is just a cast, so no unnecessary objects are - * created. For example: - *
    - *     WritableMemory wMem = ...
    - *     Memory mem = wMem;
    - * 
    - *
  • - * - *
  • {@link java.lang.AutoCloseable} for the external resources that require it, - * which enables compile-time checks for non-closed resources.
  • - * - *
  • Immediate invalidation of all downstream references of an AutoCloseable - * resource when that resource is closed, either manually or by the JVM. - * This virtually eliminates the possibility of use-after-close errors.
  • - * - *
  • Improved performance over the prior Memory implementation.
  • - * - *
  • Cleaner internal architecture, which will make it easier to extend in the future.
  • - * - *
  • No external dependencies, which makes it simple to install in virtually any Java environment. - *
  • - *
- * - *

More specifically, this package provides access to four different types of resources using - * two different access APIs. These resources can be viewed as contiguous blobs of bytes that provide at least - * byte-level read and write access. The four resources are:

- * - *
  • Off-heap memory allocated by the user.
  • - *
  • Memory-mapped files, both writable and read-only.
  • - *
  • {@code ByteBuffers}, both heap and off-heap, writable and read-only.
  • - *
  • Heap-based primitive arrays, which can be accessed as writable or read-only.
  • - *
- * - *

The two different access APIs are:

- *
  • Memory, WritableMemory: Absolute offset addressing into a resource.
  • - *
  • Buffer, WritableBuffer: Position relative addressing into a resource.
  • - *
- * - *

In addition, all combinations of access APIs and backing resources can be accessed via - * multibyte primitive methods (e.g., - * getLong(...), getLongArray(...), putLong(...), putLongArray(...)) as either - * {@link java.nio.ByteOrder#BIG_ENDIAN} or {@link java.nio.ByteOrder#LITTLE_ENDIAN}.

- * - *

The resources don't know or care about the access APIs, and the access - * APIs don't really know or care what resource they are accessing.

- * - *

An off-heap or memory-mapped file resource can also be explicitly closed by the user

- *
- *     //Using try-with-resources block:
- *     try (WritableMemory wmem = WritableMemory.map(File file)) {
- *       doWork(wMem) // read and write to memory mapped file.
- *     }
- *
- *     //Using explicit close():
- *     WritableMemory wmem = WritableMemory.map(File file);
- *     doWork(wMem) // read and write to memory mapped file.
- *     wmem.close();
- * 
- * - *

Whatever thread of your process is responsible for allocating an off-heap or memory-mapped resource - * is responsible for closing it or making sure it gets closed. This is also true for the special - * memory-mapping methods load(), isLoaded() and force().

- * - *

Moving back and forth between Memory and Buffer:

- *
- *    Memory mem = ...
- *    Buffer buf = mem.asBuffer();
- *    ...
- *    Memory mem2 = buf.asMemory();
- *    ...
- * 
- * - *

Hierarchical memory regions can be easily created:

- *
- *     WritableMemory wMem = ...
- *     WritableMemory wReg = wMem.writableRegion(offset, length); //OR
- *     Memory region = wMem.region(offset, length);
- * 
- * - *

All methods are checked for bounds violations.

- * - *

The classes in this package are not thread-safe.

- * - * @author Lee Rhodes - */ -package org.apache.datasketches.memory; diff --git a/datasketches-memory-java8/src/main/javadoc/overview.html b/datasketches-memory-java8/src/main/javadoc/overview.html deleted file mode 100644 index 86ef2bb5..00000000 --- a/datasketches-memory-java8/src/main/javadoc/overview.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - -

Memory

-

Overview

- -

Memory Package Overview

- -

Note: If the requirements or promises of any method's contract are not fulfilled (that is, if there is a bug in either the method or its caller), then an unchecked exception will be thrown. The precise type of such an unchecked exception does not form part of any method's contract.

- - \ No newline at end of file diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java deleted file mode 100644 index aac1142f..00000000 --- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Note: Lincoln's Gettysburg Address is in the public domain. See LICENSE. - */ - -package org.apache.datasketches.memory.internal; - -import static org.apache.datasketches.memory.internal.Util.getResourceFile; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import java.io.File; -import java.io.IOException; -import java.nio.ByteOrder; -import java.nio.charset.StandardCharsets; - -import org.apache.datasketches.memory.Memory; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -public class AllocateDirectMapMemoryTest { - - private static final String LS = System.getProperty("line.separator"); - - @BeforeClass - public void setReadOnly() { - if (System.getProperty("os.name").startsWith("Windows")) { - return; // Or force unmap or skip the toggle-in-place test for Windows - } - UtilTest.setGettysburgAddressFileToReadOnly(); - } - - @Test(expectedExceptions = IllegalStateException.class) - public void simpleMap() throws IOException { - File file = getResourceFile("GettysburgAddress.txt"); - assertTrue(AllocateDirectWritableMap.isFileReadOnly(file)); - try (Memory mem = Memory.map(file)) { - mem.close(); //explicit close - } //The Try-With-Resources will throw if already closed - } - - @Test - public void printGettysbergAddress() throws IOException { - File file = getResourceFile("GettysburgAddress.txt"); - try (Memory mem = Memory.map(file)) - { - int len1 = (int)mem.getCapacity(); - println("Mem Cap: " + len1); - println("Total Offset: " + mem.getRelativeOffset()); - println("Cum Offset: " + ((ResourceImpl)mem).getCumulativeOffset(0)); - println("Total Offset: " + mem.getRelativeOffset()); - byte[] bArr = new byte[len1]; - mem.getByteArray(0, bArr, 0, len1); - String s = new String(bArr, StandardCharsets.UTF_8); - println(s); - - println(""); - Memory mem2 = mem.region(43 + 76, 34); - int len2 = (int)mem2.getCapacity(); - println("Mem Cap: " + len2); - println("Offset: " + mem.getRelativeOffset()); - println("Cum Offset: " + ((ResourceImpl)mem2).getCumulativeOffset(0)); - println("Total Offset: " + mem2.getRelativeOffset()); - byte[] bArr2 = new byte[len2]; - mem2.getByteArray(0, bArr2, 0, len2); - String s2 = new String(bArr2,StandardCharsets.UTF_8); - println(s2); - assertEquals(s2,"a new nation, conceived in Liberty"); - } - } - - @Test - public void testIllegalArguments() throws IOException { - File file = getResourceFile("GettysburgAddress.txt"); - try (Memory mem = Memory.map(file, -1, Integer.MAX_VALUE, ByteOrder.nativeOrder())) { - fail("Failed: Position was negative."); - } catch (IllegalArgumentException e) { - //ok - } - - try (Memory mem = Memory.map(file, 0, -1, ByteOrder.nativeOrder())) { - fail("Failed: Size was negative."); - } catch (IllegalArgumentException e) { - //ok - } - } - - @Test(expectedExceptions = IllegalStateException.class) - public void testAccessAfterClose() throws IOException { - File file = getResourceFile("GettysburgAddress.txt"); - long memCapacity = file.length(); - try (Memory mem = Memory.map(file, 0, memCapacity, ByteOrder.nativeOrder())) { - assertEquals(memCapacity, mem.getCapacity()); - } //normal close via TWR - Memory mem = Memory.map(file, 0, memCapacity, ByteOrder.nativeOrder()); - mem.close(); //normal manual close - mem.getCapacity(); //isLoaded(); //already closed, invalid - } - - @Test(expectedExceptions = IllegalStateException.class) - public void testReadFailAfterClose() throws IOException { - File file = getResourceFile("GettysburgAddress.txt"); - long memCapacity = file.length(); - Memory mem = Memory.map(file, 0, memCapacity, ByteOrder.nativeOrder()); - mem.close(); - mem.isLoaded(); - } - - @Test - public void testLoad() throws IOException { - File file = getResourceFile("GettysburgAddress.txt"); - long memCapacity = file.length(); - try (Memory mem = Memory.map(file, 0, memCapacity, ByteOrder.nativeOrder())) { - mem.load(); - assertTrue(mem.isLoaded()); - } //normal TWR close - } - - @Test - public void printlnTest() { - println("PRINTING: " + this.getClass().getName()); - } - - static void println(final Object o) { - if (o == null) { print(LS); } - else { print(o.toString() + LS); } - } - - /** - * @param o value to print - */ - static void print(final Object o) { - if (o != null) { - //System.out.print(o.toString()); //disable here - } - } - -} diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java deleted file mode 100644 index 14a8629c..00000000 --- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/UtilTest.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -/* - * Note: Lincoln's Gettysburg Address is in the public domain. See LICENSE. - */ - -package org.apache.datasketches.memory.internal; - -import static org.apache.datasketches.memory.internal.Util.characterPad; -import static org.apache.datasketches.memory.internal.Util.getResourceBytes; -import static org.apache.datasketches.memory.internal.Util.getResourceFile; -import static org.apache.datasketches.memory.internal.Util.negativeCheck; -import static org.apache.datasketches.memory.internal.Util.nullCheck; -import static org.apache.datasketches.memory.internal.Util.zeroCheck; -import static org.apache.datasketches.memory.internal.Util.zeroPad; -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.LinkOption; -import java.nio.file.attribute.PosixFileAttributeView; -import java.nio.file.attribute.PosixFileAttributes; -import java.nio.file.attribute.PosixFilePermissions; - -import org.apache.datasketches.memory.MemoryBoundsException; -import org.apache.datasketches.memory.WritableMemory; -import org.testng.annotations.Test; - -public class UtilTest { - private static final String LS = System.getProperty("line.separator"); - - //Binary Search - @Test - public void checkBinarySearch() { - int k = 1024; //longs - WritableMemory wMem = WritableMemory.allocate(k << 3); //1024 longs - for (int i = 0; i < k; i++) { wMem.putLong(i << 3, i); } - long idx = Util.binarySearchLongs(wMem, 0, k - 1, k / 2); - long val = wMem.getLong(idx << 3); - assertEquals(idx, k / 2); - assertEquals(val, k / 2); - - idx = Util.binarySearchLongs(wMem, 0, k - 1, k); - assertEquals(idx, -1024); - } - - @Test(expectedExceptions = MemoryBoundsException.class) - public void checkBoundsTest() { - ResourceImpl.checkBounds(999, 2, 1000); - } - - @Test - public void checkPadding() { - String s = "123"; - String t = zeroPad(s, 4); - assertTrue(t.startsWith("0")); - - t = characterPad(s, 4, '0', true); - assertTrue(t.endsWith("0")); - - t = characterPad(s, 3, '0', false); - assertEquals(s, t); - } - - @Test - public void checkNullZeroNegativeChecks() { - Object obj = null; - try { - nullCheck(obj, "Test Object"); - fail(); - } catch (IllegalArgumentException e) { - //OK - } - try { - zeroCheck(0, "Test Long"); - fail(); - } catch (IllegalArgumentException e) { - //OK - } - try { - negativeCheck(-1L, "Test Long"); - fail(); - } catch (IllegalArgumentException e) { - //OK - } - } - - @Test - public void checkCodePointArr() { - final Util.RandomCodePoints rvcp = new Util.RandomCodePoints(true); - final int n = 1000; - final int[] cpArr = new int[n]; - rvcp.fillCodePointArray(cpArr); - for (int i = 0; i < n; i++) { - int cp = cpArr[i]; - if ((cp >= Character.MIN_SURROGATE) && (cp <= Character.MAX_SURROGATE)) { - fail(); - } - } - } - - @Test - public void checkCodePoint() { - final Util.RandomCodePoints rvcp = new Util.RandomCodePoints(true); - final int n = 1000; - for (int i = 0; i < n; i++) { - int cp = rvcp.getCodePoint(); - if ((cp >= Character.MIN_SURROGATE) && (cp <= Character.MAX_SURROGATE)) { - fail(); - } - } - } - - static final String getFileAttributes(File file) { - try { - PosixFileAttributes attrs = Files.getFileAttributeView( - file.toPath(), PosixFileAttributeView.class, new LinkOption[0]).readAttributes(); - String s = String.format("%s: %s %s %s%n", - file.getPath(), - attrs.owner().getName(), - attrs.group().getName(), - PosixFilePermissions.toString(attrs.permissions())); - return s; - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - static final void setGettysburgAddressFileToReadOnly() { - File file = getResourceFile("GettysburgAddress.txt"); - try { - Files.setPosixFilePermissions(file.toPath(), PosixFilePermissions.fromString("r--r--r--")); - } catch (IOException e) { - throw new RuntimeException(e); - } - } - - //Resources - - @Test - public void resourceFileExits() { - final String shortFileName = "GettysburgAddress.txt"; - final File file = getResourceFile(shortFileName); - assertTrue(file.exists()); - } - - @Test(expectedExceptions = NullPointerException.class) - public void resourceFileNotFound() { - final String shortFileName = "GettysburgAddress.txt"; - getResourceFile(shortFileName + "123"); - } - - @Test - public void resourceBytesCorrect() { - final String shortFileName = "GettysburgAddress.txt"; - final byte[] bytes = getResourceBytes(shortFileName); - assertTrue(bytes.length == 1541); - } - - @Test(expectedExceptions = NullPointerException.class) - public void resourceBytesFileNotFound() { - final String shortFileName = "GettysburgAddress.txt"; - getResourceBytes(shortFileName + "123"); - } - - @Test - public void printlnTest() { - println("PRINTING: " + this.getClass().getName()); - } - - static void println(final Object o) { - if (o == null) { print(LS); } - else { print(o.toString() + LS); } - } - - /** - * @param o value to print - */ - static void print(final Object o) { - if (o != null) { - //System.out.print(o.toString()); //disable here - } - } - -} diff --git a/datasketches-memory-java8/src/test/resources/GettysburgAddress.txt b/datasketches-memory-java8/src/test/resources/GettysburgAddress.txt deleted file mode 100644 index 3969d176..00000000 --- a/datasketches-memory-java8/src/test/resources/GettysburgAddress.txt +++ /dev/null @@ -1,7 +0,0 @@ -Abraham Lincoln's Gettysburg Address: - - Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal. - - Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived and so dedicated, can long endure. We are met on a great battle-field of that war. We have come to dedicate a portion of that field, as a final resting place for those who here gave their lives that that nation might live. It is altogether fitting and proper that we should do this. - - But, in a larger sense, we can not dedicate —- we can not consecrate —- we can not hallow —- this ground. The brave men, living and dead, who struggled here, have consecrated it, far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced. It is rather for us to be here dedicated to the great task remaining before us -— that from these honored dead we take increased devotion to that cause for which they gave the last full measure of devotion -— that we here highly resolve that these dead shall not have died in vain -— that this nation, under God, shall have a new birth of freedom -— and that government of the people, by the people, for the people, shall not perish from the earth. diff --git a/datasketches-memory-report/pom.xml b/datasketches-memory-report/pom.xml index 8409abfa..0f1b422b 100644 --- a/datasketches-memory-report/pom.xml +++ b/datasketches-memory-report/pom.xml @@ -40,11 +40,6 @@ under the License. - - org.apache.datasketches - datasketches-memory-java8 - ${project.version} - org.apache.datasketches datasketches-memory-java11 @@ -86,7 +81,7 @@ under the License. - org/apache/datasketches/memory/internal/VirtualMachineMemory.class + diff --git a/pom.xml b/pom.xml index dbe4eb15..62dd5ca8 100644 --- a/pom.xml +++ b/pom.xml @@ -147,6 +147,7 @@ under the License. 1.0.0 + 2.0.12 2026.0 @@ -327,8 +328,9 @@ under the License. @{argLine} @{jvm.args} false + false false - true + false ${project.build.directory}/test-output/${maven.build.timestamp} false @@ -521,7 +523,6 @@ under the License. The submodules target different version-specific features of the Java language APIs. --> - datasketches-memory-java8 datasketches-memory-java11 datasketches-memory-report