You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by dc...@apache.org on 2021/03/02 21:55:17 UTC

[datasketches-memory] branch java-11-experimental updated: Inital version that compiles

This is an automated email from the ASF dual-hosted git repository.

dcromberge pushed a commit to branch java-11-experimental
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git


The following commit(s) were added to refs/heads/java-11-experimental by this push:
     new 676aeef  Inital version that compiles
676aeef is described below

commit 676aeef23f5f56c0f56125e407bcb272c285b335
Author: David Cromberge <da...@gmail.com>
AuthorDate: Tue Mar 2 21:54:55 2021 +0000

    Inital version that compiles
---
 pom.xml                                            | 33 ++++++++++++++++++----
 .../apache/datasketches/memory/AllocateDirect.java |  5 ++--
 .../datasketches/memory/AllocateDirectMap.java     |  2 +-
 .../org/apache/datasketches/memory/NioBits.java    |  8 +++---
 4 files changed, 35 insertions(+), 13 deletions(-)

diff --git a/pom.xml b/pom.xml
index b3447ce..82326c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -20,7 +20,7 @@ under the License.
 -->
 
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
   <modelVersion>4.0.0</modelVersion>
 
   <parent>
@@ -97,7 +97,7 @@ under the License.
 
     <!-- System-wide properties -->
     <maven.version>3.5.0</maven.version>
-    <java.version>1.8</java.version>
+    <java.version>11</java.version>
     <maven.compiler.source>${java.version}</maven.compiler.source>
     <maven.compiler.target>${java.version}</maven.compiler.target>
     <argLine>-Xmx4g -Duser.language=en -Duser.country=US -Dfile.encoding=UTF-8</argLine>
@@ -110,7 +110,7 @@ under the License.
     <!-- used for strict profile testing-->
     <plexus-compiler-javac-errorprone.version>2.8.5</plexus-compiler-javac-errorprone.version>
     <versions-maven-plugin.version>2.8.1</versions-maven-plugin.version>
-    
+
     <!--  Maven Plugins -->
     <maven-assembly-plugin.version>3.3.0</maven-assembly-plugin.version> <!-- overrides parent -->
     <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version> <!-- overrides parent -->
@@ -347,6 +347,13 @@ under the License.
             <trimStackTrace>false</trimStackTrace>
             <useManifestOnlyJar>false</useManifestOnlyJar>
             <redirectTestOutputToFile>true</redirectTestOutputToFile>
+            <argLine>
+              --add-opens java.base/jdk.internal.misc=ALL-UNNAMED
+              --add-opens java.base/java.nio=ALL-UNNAMED
+              --add-exports java.base/sun.nio.ch=ALL-UNNAMED
+              --add-exports java.base/jdk.internal.ref=ALL-UNNAMED
+              --illegal-access=warn
+            </argLine>
           </configuration>
         </plugin>
         <plugin>
@@ -372,6 +379,22 @@ under the License.
             <!-- Since we use Travis CI we do not have to put a Coveralls token here. -->
           </configuration>
         </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-compiler-plugin</artifactId>
+          <version>${maven-compiler-plugin.version}</version>
+          <configuration>
+            <source>${maven.compiler.source}</source>
+            <target>${maven.compiler.target}</target>
+            <compilerArgs>
+              <arg>--add-exports</arg>
+              <arg>java.base/sun.nio.ch=ALL-UNNAMED</arg>
+              <arg>--add-exports</arg>
+              <arg>java.base/jdk.internal.ref=ALL-UNNAMED</arg>
+            </compilerArgs>
+          </configuration>
+        </plugin>
+
       </plugins>
     </pluginManagement>
     <plugins>
@@ -418,10 +441,10 @@ under the License.
     </plugins>
   </build>
   <profiles>
-    <!-- Ignore nuisance warning from Apache parent plugin: 
+    <!-- Ignore nuisance warning from Apache parent plugin:
           "maven-remote-resources-plugin (goal "process") is ignored by m2e".
           This also should fix the Maven warning that it can't find the lifecycle-mapping jar.
-          This profile is only active when the property "m2e.version" is set, 
+          This profile is only active when the property "m2e.version" is set,
           which is the case when building in Eclipse with m2e.
           The ignore below tells m2eclipse to skip the execution.
     -->
diff --git a/src/main/java/org/apache/datasketches/memory/AllocateDirect.java b/src/main/java/org/apache/datasketches/memory/AllocateDirect.java
index e699e1f..92ad8f3 100644
--- a/src/main/java/org/apache/datasketches/memory/AllocateDirect.java
+++ b/src/main/java/org/apache/datasketches/memory/AllocateDirect.java
@@ -21,11 +21,10 @@ package org.apache.datasketches.memory;
 
 import static org.apache.datasketches.memory.UnsafeUtil.unsafe;
 
+import jdk.internal.ref.Cleaner;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import sun.misc.Cleaner;
-
 /**
  * Provides access to direct (native) memory.
  *
@@ -36,7 +35,7 @@ final class AllocateDirect implements AutoCloseable {
   private static final Logger LOG = LoggerFactory.getLogger(AllocateDirect.class);
 
   private final Deallocator deallocator;
-  private final Cleaner cleaner; //TODO-JDK9 import jdk.internal.ref.Cleaner;
+  private final Cleaner cleaner;
   private final long nativeBaseOffset;
 
   /**
diff --git a/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java b/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java
index 41cdf46..4702e94 100644
--- a/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java
+++ b/src/main/java/org/apache/datasketches/memory/AllocateDirectMap.java
@@ -30,10 +30,10 @@ import java.lang.reflect.Method;
 import java.nio.MappedByteBuffer;
 import java.nio.channels.FileChannel;
 
+import jdk.internal.ref.Cleaner;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import sun.misc.Cleaner; //TODO-JDK9 jdk.internal.ref.Cleaner;
 import sun.nio.ch.FileChannelImpl;
 
 /**
diff --git a/src/main/java/org/apache/datasketches/memory/NioBits.java b/src/main/java/org/apache/datasketches/memory/NioBits.java
index ac853e1..6398726 100644
--- a/src/main/java/org/apache/datasketches/memory/NioBits.java
+++ b/src/main/java/org/apache/datasketches/memory/NioBits.java
@@ -49,7 +49,7 @@ final class NioBits {
 
   static {
     try {
-      VM_CLASS = Class.forName("sun.misc.VM");
+      VM_CLASS = Class.forName("jdk.internal.misc.VM");
       VM_MAX_DIRECT_MEMORY_METHOD =
           VM_CLASS.getDeclaredMethod("maxDirectMemory");
       VM_MAX_DIRECT_MEMORY_METHOD.setAccessible(true);
@@ -72,15 +72,15 @@ final class NioBits {
           .getDeclaredMethod("unreserveMemory", long.class, int.class);
       NIO_BITS_UNRESERVE_MEMORY_METHOD.setAccessible(true);
 
-      final Field countField = NIO_BITS_CLASS.getDeclaredField("count");
+      final Field countField = NIO_BITS_CLASS.getDeclaredField("COUNT");
       countField.setAccessible(true);
       nioBitsCount = (AtomicLong) (countField.get(null));
 
-      final Field reservedMemoryField = NIO_BITS_CLASS.getDeclaredField("reservedMemory");
+      final Field reservedMemoryField = NIO_BITS_CLASS.getDeclaredField("RESERVED_MEMORY");
       reservedMemoryField.setAccessible(true);
       nioBitsReservedMemory = (AtomicLong) (reservedMemoryField.get(null));
 
-      final Field totalCapacityField = NIO_BITS_CLASS.getDeclaredField("totalCapacity");
+      final Field totalCapacityField = NIO_BITS_CLASS.getDeclaredField("TOTAL_CAPACITY");
       totalCapacityField.setAccessible(true);
       nioBitsTotalCapacity = (AtomicLong) (totalCapacityField.get(null));
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org