I'm currently using Java 8 and want to migrate to Java 11.
The jdeps -P -jdkinternals ...
command listed below classes as not supported from Java 10.
sun.rmi.server.UnicastRef
sun.rmi.server.UnicastRef2
sun.rmi.transport.Endpoint
sun.rmi.transport.LiveRef
sun.rmi.transport.tcp.TCPEndpoint
Can someone please help me out in searching the alternatives for the above listed classes?
Output of JDEPS in JDK 11:
digraph "AppCore.jar" {
// Path: D:\jdeps\srclib\AppCore.jar
"com.util.RMIServer" -> "sun.rmi.server.UnicastRef (JDK internal API (java.rmi))";
"com.util.RMIServer" -> "sun.rmi.server.UnicastRef2 (JDK internal API (java.rmi))";
"com.util.RMIServer" -> "sun.rmi.transport.Endpoint (JDK internal API (java.rmi))";
"com.util.RMIServer" -> "sun.rmi.transport.LiveRef (JDK internal API (java.rmi))";
"com.util.RMIServer" -> "sun.rmi.transport.tcp.TCPEndpoint (JDK internal API (java.rmi))";
"com.util.WrappedPostlessSocket" -> "sun.rmi.transport.proxy.RMISocketInfo (JDK internal API (JDK removed internal API))";
}
Thanks.
JDK 11 allows us to make use of few Internal APIs by exporting the module in a project with a warning like below:
warning: UnicastRef is internal proprietary API and may be removed in a future release.
The warning clearly states that what is going to happen.
Command:
javac --add-exports java.rmi/sun.rmi.server=ALL-UNNAMED RMIServer.java
Where, java.rmi -> is a module name,
sun.rmi.server -> is the package name,
RMIServer.java -> Class in which package sun.rmi.server is imported.
There are few other internal APIs that are moved to jdk.internal...* packages in java 9, which can be accessed without any warning as below:
javac --add -exports jdk.management.agent/jdk.internal.agent=ALL-UNNAMED HelloWorld.java
Note: This question is not related to whether to make use of internal API directly in your application code. As there are software products developed using internal APIs 15+ years back and still they exists in java 8.