New posts
This commit is contained in:
@@ -0,0 +1,119 @@
|
||||
== openjdk version "21.0.12.1" 2026-08-18
|
||||
java.version=21.0.12.1
|
||||
public methods declared by sun.misc.Unsafe: 88
|
||||
deprecated for removal: 2
|
||||
not deprecated for removal: 86
|
||||
addressSize
|
||||
allocateInstance
|
||||
allocateMemory
|
||||
arrayBaseOffset
|
||||
arrayIndexScale
|
||||
compareAndSwapInt
|
||||
compareAndSwapLong
|
||||
compareAndSwapObject
|
||||
copyMemory
|
||||
copyMemory
|
||||
freeMemory
|
||||
fullFence
|
||||
getAddress
|
||||
getAndAddInt
|
||||
getAndAddLong
|
||||
getAndSetInt
|
||||
getAndSetLong
|
||||
getAndSetObject
|
||||
getBoolean
|
||||
getBooleanVolatile
|
||||
getByte
|
||||
getByte
|
||||
getByteVolatile
|
||||
getChar
|
||||
getChar
|
||||
getCharVolatile
|
||||
getDouble
|
||||
getDouble
|
||||
getDoubleVolatile
|
||||
getFloat
|
||||
getFloat
|
||||
getFloatVolatile
|
||||
getInt
|
||||
getInt
|
||||
getIntVolatile
|
||||
getLoadAverage
|
||||
getLong
|
||||
getLong
|
||||
getLongVolatile
|
||||
getObject
|
||||
getObjectVolatile
|
||||
getShort
|
||||
getShort
|
||||
getShortVolatile
|
||||
invokeCleaner
|
||||
loadFence
|
||||
objectFieldOffset (deprecated, not for removal)
|
||||
pageSize
|
||||
park
|
||||
putAddress
|
||||
putBoolean
|
||||
putBooleanVolatile
|
||||
putByte
|
||||
putByte
|
||||
putByteVolatile
|
||||
putChar
|
||||
putChar
|
||||
putCharVolatile
|
||||
putDouble
|
||||
putDouble
|
||||
putDoubleVolatile
|
||||
putFloat
|
||||
putFloat
|
||||
putFloatVolatile
|
||||
putInt
|
||||
putInt
|
||||
putIntVolatile
|
||||
putLong
|
||||
putLong
|
||||
putLongVolatile
|
||||
putObject
|
||||
putObjectVolatile
|
||||
putOrderedInt
|
||||
putOrderedLong
|
||||
putOrderedObject
|
||||
putShort
|
||||
putShort
|
||||
putShortVolatile
|
||||
reallocateMemory
|
||||
setMemory
|
||||
setMemory
|
||||
staticFieldBase (deprecated, not for removal)
|
||||
staticFieldOffset (deprecated, not for removal)
|
||||
storeFence
|
||||
throwException
|
||||
unpark
|
||||
|
||||
== openjdk version "25.0.5" 2026-10-20 LTS
|
||||
java.version=25.0.5
|
||||
public methods declared by sun.misc.Unsafe: 86
|
||||
deprecated for removal: 83
|
||||
not deprecated for removal: 3
|
||||
allocateInstance
|
||||
pageSize
|
||||
throwException
|
||||
|
||||
== openjdk version "26.0.2.1" 2026-08-18
|
||||
java.version=26.0.2.1
|
||||
public methods declared by sun.misc.Unsafe: 86
|
||||
deprecated for removal: 83
|
||||
not deprecated for removal: 3
|
||||
allocateInstance
|
||||
pageSize
|
||||
throwException
|
||||
|
||||
== openjdk version "27.0.1.0.2" 2026-10-21
|
||||
java.version=27.0.1.0.2
|
||||
public methods declared by sun.misc.Unsafe: 86
|
||||
deprecated for removal: 83
|
||||
not deprecated for removal: 3
|
||||
allocateInstance
|
||||
pageSize
|
||||
throwException
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
$ javac src/UnsafeAccess.java broken/Probe.java (openjdk version "25.0.5" 2026-10-20 LTS)
|
||||
src/UnsafeAccess.java:2: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
broken/Probe.java:1: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
src/UnsafeAccess.java:8: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
src/UnsafeAccess.java:10: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
src/UnsafeAccess.java:12: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
broken/Probe.java:9: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
broken/Probe.java:12: warning: [removal] allocateMemory(long) in Unsafe has been deprecated and marked for removal
|
||||
broken/Probe.java:13: warning: [removal] putLong(long,long) in Unsafe has been deprecated and marked for removal
|
||||
broken/Probe.java:14: warning: [removal] getLong(long) in Unsafe has been deprecated and marked for removal
|
||||
broken/Probe.java:15: warning: [removal] freeMemory(long) in Unsafe has been deprecated and marked for removal
|
||||
broken/Probe.java:21: warning: [removal] allocateMemory(long) in Unsafe has been deprecated and marked for removal
|
||||
broken/Probe.java:22: warning: [removal] putLong(long,long) in Unsafe has been deprecated and marked for removal
|
||||
broken/Probe.java:23: warning: [removal] getLong(long) in Unsafe has been deprecated and marked for removal
|
||||
broken/Probe.java:24: warning: [removal] freeMemory(long) in Unsafe has been deprecated and marked for removal
|
||||
14 warnings
|
||||
|
||||
$ javac src/UnsafeAccess.java broken/Probe.java (openjdk version "21.0.12.1" 2026-08-18)
|
||||
src/UnsafeAccess.java:2: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
broken/Probe.java:1: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
src/UnsafeAccess.java:8: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
src/UnsafeAccess.java:10: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
src/UnsafeAccess.java:12: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
broken/Probe.java:9: warning: Unsafe is internal proprietary API and may be removed in a future release
|
||||
6 warnings
|
||||
|
||||
$ javac -Xlint:removal -Werror src/UnsafeAccess.java broken/Probe.java (openjdk version "25.0.5" 2026-10-20 LTS)
|
||||
error: warnings found and -Werror specified
|
||||
broken/Probe.java:12: warning: [removal] allocateMemory(long) in Unsafe has been deprecated and marked for removal
|
||||
broken/Probe.java:13: warning: [removal] putLong(long,long) in Unsafe has been deprecated and marked for removal
|
||||
broken/Probe.java:14: warning: [removal] getLong(long) in Unsafe has been deprecated and marked for removal
|
||||
broken/Probe.java:15: warning: [removal] freeMemory(long) in Unsafe has been deprecated and marked for removal
|
||||
broken/Probe.java:21: warning: [removal] allocateMemory(long) in Unsafe has been deprecated and marked for removal
|
||||
exit=1
|
||||
@@ -0,0 +1,64 @@
|
||||
$ java -cp build Probe (JDK 25 default)
|
||||
got Unsafe instance
|
||||
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
||||
WARNING: sun.misc.Unsafe::allocateMemory has been called by Probe (file:<build>/c25/)
|
||||
WARNING: Please consider reporting this to the maintainers of class Probe
|
||||
WARNING: sun.misc.Unsafe::allocateMemory will be removed in a future release
|
||||
read back 42
|
||||
allocate/put/get/free all succeeded
|
||||
second use read 7
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=allow -cp build Probe
|
||||
got Unsafe instance
|
||||
read back 42
|
||||
allocate/put/get/free all succeeded
|
||||
second use read 7
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=warn -cp build Probe
|
||||
got Unsafe instance
|
||||
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
||||
WARNING: sun.misc.Unsafe::allocateMemory has been called by Probe (file:<build>/c25/)
|
||||
WARNING: Please consider reporting this to the maintainers of class Probe
|
||||
WARNING: sun.misc.Unsafe::allocateMemory will be removed in a future release
|
||||
read back 42
|
||||
allocate/put/get/free all succeeded
|
||||
second use read 7
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=debug -cp build Probe
|
||||
got Unsafe instance
|
||||
WARNING: sun.misc.Unsafe::allocateMemory called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:12)
|
||||
WARNING: sun.misc.Unsafe::putLong called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:13)
|
||||
WARNING: sun.misc.Unsafe::getLong called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:14)
|
||||
read back 42
|
||||
WARNING: sun.misc.Unsafe::freeMemory called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:15)
|
||||
allocate/put/get/free all succeeded
|
||||
WARNING: sun.misc.Unsafe::allocateMemory called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:21)
|
||||
WARNING: sun.misc.Unsafe::putLong called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:22)
|
||||
WARNING: sun.misc.Unsafe::getLong called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:23)
|
||||
second use read 7
|
||||
WARNING: sun.misc.Unsafe::freeMemory called by Probe (file:<build>/c25/)
|
||||
at Probe.main(Probe.java:24)
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=deny -cp build Probe
|
||||
got Unsafe instance
|
||||
FAILED: java.lang.UnsupportedOperationException: allocateMemory
|
||||
second use FAILED: java.lang.UnsupportedOperationException: allocateMemory
|
||||
|
||||
# the JVM also publishes the flag as a system property that libraries can read
|
||||
$ java tools/Prop.java (default)
|
||||
sun.misc.unsafe.memory.access=null
|
||||
$ java --sun-misc-unsafe-memory-access=allow tools/Prop.java
|
||||
sun.misc.unsafe.memory.access=allow
|
||||
$ java --sun-misc-unsafe-memory-access=warn tools/Prop.java
|
||||
sun.misc.unsafe.memory.access=warn
|
||||
$ java --sun-misc-unsafe-memory-access=debug tools/Prop.java
|
||||
sun.misc.unsafe.memory.access=debug
|
||||
$ java --sun-misc-unsafe-memory-access=deny tools/Prop.java
|
||||
sun.misc.unsafe.memory.access=deny
|
||||
@@ -0,0 +1,25 @@
|
||||
$ java -cp build Probe (openjdk version "21.0.12.1" 2026-08-18, class file compiled by JDK 21)
|
||||
got Unsafe instance
|
||||
read back 42
|
||||
allocate/put/get/free all succeeded
|
||||
second use read 7
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=deny -cp build Probe (openjdk version "21.0.12.1" 2026-08-18)
|
||||
Unrecognized option: --sun-misc-unsafe-memory-access=deny
|
||||
Error: Could not create the Java Virtual Machine.
|
||||
Error: A fatal exception has occurred. Program will exit.
|
||||
|
||||
$ java -cp build Probe (openjdk version "26.0.2.1" 2026-08-18)
|
||||
got Unsafe instance
|
||||
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
||||
WARNING: sun.misc.Unsafe::allocateMemory has been called by Probe (file:<build>/c25/)
|
||||
WARNING: Please consider reporting this to the maintainers of class Probe
|
||||
...
|
||||
|
||||
$ java -cp build Probe (openjdk version "27.0.1.0.2" 2026-10-21)
|
||||
got Unsafe instance
|
||||
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
||||
WARNING: sun.misc.Unsafe::allocateMemory has been called by Probe (file:<build>/c25/)
|
||||
WARNING: Please consider reporting this to the maintainers of class Probe
|
||||
...
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
$ jdeps --jdk-internals build (openjdk version "25.0.5" 2026-10-20 LTS)
|
||||
c25 -> jdk.unsupported
|
||||
Probe -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
|
||||
UnsafeAccess -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
|
||||
|
||||
Warning: JDK internal APIs are unsupported and private to JDK implementation that are
|
||||
subject to be removed or changed incompatibly and could break your application.
|
||||
Please modify your code to eliminate dependence on any JDK internal APIs.
|
||||
For the most recent update on JDK internal API replacements, please check:
|
||||
https://wiki.openjdk.org/display/JDK8/Java+Dependency+Analysis+Tool
|
||||
|
||||
JDK Internal API Suggested Replacement
|
||||
---------------- ---------------------
|
||||
sun.misc.Unsafe See https://openjdk.org/jeps/260
|
||||
@@ -0,0 +1,109 @@
|
||||
sha1 ok io.netty:netty-common:4.2.20.Final
|
||||
sha1 ok io.netty:netty-common:4.1.140.Final
|
||||
sha1 ok io.netty:netty-common:4.1.100.Final
|
||||
sha1 ok com.google.guava:guava:33.8.0-jre
|
||||
sha1 ok com.google.guava:guava:32.1.3-jre
|
||||
sha1 ok org.apache.lucene:lucene-core:10.6.0
|
||||
sha1 ok org.apache.lucene:lucene-core:9.12.3
|
||||
sha1 ok com.esotericsoftware:kryo:5.7.1
|
||||
sha1 ok org.apache.hadoop:hadoop-common:3.5.0
|
||||
sha1 ok org.apache.hadoop:hadoop-common:3.3.6
|
||||
sha1 ok org.apache.cassandra:cassandra-all:5.0.9
|
||||
sha1 ok org.agrona:agrona:2.7.1
|
||||
sha1 ok org.jctools:jctools-core:4.0.7
|
||||
sha1 ok com.github.ben-manes.caffeine:caffeine:3.3.1
|
||||
sha1 ok com.google.protobuf:protobuf-java:4.36.2
|
||||
sha1 ok org.xerial.snappy:snappy-java:1.1.10.12
|
||||
sha1 ok org.apache.spark:spark-unsafe_2.13:4.3.0
|
||||
|
||||
this JDK: sun.misc.Unsafe has 86 public methods, 83 deprecated for removal
|
||||
|
||||
netty-common-4.2.20.Final.jar: 657 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 22
|
||||
classes calling a removal-deprecated Unsafe method: 21 (125 call sites, 34 distinct methods)
|
||||
methods: {addressSize=1, allocateMemory=4, arrayBaseOffset=5, arrayIndexScale=5, compareAndSwapInt=1, compareAndSwapLong=6, compareAndSwapObject=1, copyMemory=4, freeMemory=4, getAndAddInt=1, getBoolean=1, getByte=10, getChar=5, getInt=10, getIntVolatile=1, getLong=13, getLongVolatile=4, getObject=2, getObjectVolatile=2, getShort=3, objectFieldOffset=3, putByte=3, putInt=3, putLong=4, putObject=4, putOrderedInt=1, putOrderedLong=8, putOrderedObject=3, putShort=3, reallocateMemory=2, setMemory=2, staticFieldBase=2, staticFieldOffset=2, storeFence=2}
|
||||
|
||||
netty-common-4.1.140.Final.jar: 548 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 22
|
||||
classes calling a removal-deprecated Unsafe method: 21 (122 call sites, 33 distinct methods)
|
||||
methods: {addressSize=1, allocateMemory=4, arrayBaseOffset=5, arrayIndexScale=5, compareAndSwapLong=6, compareAndSwapObject=1, copyMemory=4, freeMemory=4, getBoolean=1, getByte=10, getChar=5, getInt=10, getIntVolatile=1, getLong=16, getLongVolatile=1, getObject=2, getObjectVolatile=2, getShort=3, objectFieldOffset=3, putByte=3, putInt=3, putIntVolatile=1, putLong=4, putObject=4, putOrderedInt=1, putOrderedLong=8, putOrderedObject=3, putShort=2, reallocateMemory=2, setMemory=2, staticFieldBase=2, staticFieldOffset=2, storeFence=1}
|
||||
other (not deprecated for removal) Unsafe methods called: [throwException]
|
||||
|
||||
netty-common-4.1.100.Final.jar: 492 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 15
|
||||
classes calling a removal-deprecated Unsafe method: 14 (107 call sites, 32 distinct methods)
|
||||
methods: {addressSize=1, allocateMemory=3, arrayBaseOffset=4, arrayIndexScale=4, compareAndSwapLong=3, compareAndSwapObject=1, copyMemory=4, freeMemory=3, getBoolean=1, getByte=10, getChar=5, getInt=10, getIntVolatile=1, getLong=14, getObject=2, getObjectVolatile=2, getShort=3, objectFieldOffset=3, putByte=3, putInt=3, putIntVolatile=1, putLong=2, putObject=4, putOrderedInt=1, putOrderedLong=5, putOrderedObject=3, putShort=2, reallocateMemory=2, setMemory=2, staticFieldBase=2, staticFieldOffset=2, storeFence=1}
|
||||
other (not deprecated for removal) Unsafe methods called: [throwException]
|
||||
|
||||
guava-33.8.0-jre.jar: 1972 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 5
|
||||
classes calling a removal-deprecated Unsafe method: 5 (22 call sites, 8 distinct methods)
|
||||
methods: {arrayBaseOffset=2, arrayIndexScale=2, compareAndSwapObject=3, getAndSetObject=2, getLong=4, objectFieldOffset=5, putLong=2, putObject=2}
|
||||
other (not deprecated for removal) Unsafe methods called: [getUnsafe]
|
||||
|
||||
guava-32.1.3-jre.jar: 2020 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 9
|
||||
classes calling a removal-deprecated Unsafe method: 9 (34 call sites, 10 distinct methods)
|
||||
methods: {arrayBaseOffset=2, arrayIndexScale=2, compareAndSwapInt=2, compareAndSwapLong=4, compareAndSwapObject=3, getAndSetObject=2, getLong=4, objectFieldOffset=11, putLong=2, putObject=2}
|
||||
other (not deprecated for removal) Unsafe methods called: [getUnsafe]
|
||||
|
||||
lucene-core-10.6.0.jar: 2758 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 0
|
||||
classes calling a removal-deprecated Unsafe method: 0 (0 call sites, 0 distinct methods)
|
||||
|
||||
lucene-core-9.12.3.jar: 2515 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 1
|
||||
classes calling a removal-deprecated Unsafe method: 0 (0 call sites, 0 distinct methods)
|
||||
|
||||
kryo-5.7.1.jar: 246 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 15
|
||||
classes calling a removal-deprecated Unsafe method: 15 (100 call sites, 20 distinct methods)
|
||||
methods: {copyMemory=4, getBoolean=2, getByte=10, getChar=4, getDouble=4, getFloat=4, getInt=5, getLong=5, getObject=5, getShort=4, objectFieldOffset=11, putBoolean=2, putByte=10, putChar=4, putDouble=4, putFloat=4, putInt=5, putLong=5, putObject=4, putShort=4}
|
||||
|
||||
hadoop-common-3.5.0.jar: 2633 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 4
|
||||
classes calling a removal-deprecated Unsafe method: 1 (4 call sites, 3 distinct methods)
|
||||
methods: {arrayBaseOffset=1, arrayIndexScale=1, getLong=2}
|
||||
other (not deprecated for removal) Unsafe methods called: [pageSize]
|
||||
|
||||
hadoop-common-3.3.6.jar: 2568 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 4
|
||||
classes calling a removal-deprecated Unsafe method: 1 (4 call sites, 3 distinct methods)
|
||||
methods: {arrayBaseOffset=1, arrayIndexScale=1, getLong=2}
|
||||
other (not deprecated for removal) Unsafe methods called: [pageSize]
|
||||
|
||||
cassandra-all-5.0.9.jar: 5770 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 7
|
||||
classes calling a removal-deprecated Unsafe method: 6 (152 call sites, 16 distinct methods)
|
||||
methods: {arrayBaseOffset=3, arrayIndexScale=1, copyMemory=7, getByte=46, getInt=6, getLong=15, getObject=2, getObjectVolatile=1, getShort=3, objectFieldOffset=7, putByte=43, putInt=9, putLong=4, putObject=1, putShort=2, setMemory=2}
|
||||
other (not deprecated for removal) Unsafe methods called: [allocateInstance, getUnsafe, pageSize]
|
||||
|
||||
agrona-2.7.1.jar: 295 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 0
|
||||
classes calling a removal-deprecated Unsafe method: 0 (0 call sites, 0 distinct methods)
|
||||
|
||||
jctools-core-4.0.7.jar: 356 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 58
|
||||
classes calling a removal-deprecated Unsafe method: 57 (136 call sites, 17 distinct methods)
|
||||
methods: {arrayBaseOffset=9, arrayIndexScale=8, compareAndSwapLong=22, compareAndSwapObject=14, getAndAddLong=4, getAndSetLong=2, getAndSetObject=2, getInt=2, getLong=2, getLongVolatile=20, getObject=2, getObjectVolatile=3, objectFieldOffset=2, putLong=3, putObject=5, putOrderedLong=28, putOrderedObject=8}
|
||||
other (not deprecated for removal) Unsafe methods called: [pageSize]
|
||||
|
||||
caffeine-3.3.1.jar: 801 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 0
|
||||
classes calling a removal-deprecated Unsafe method: 0 (0 call sites, 0 distinct methods)
|
||||
|
||||
protobuf-java-4.36.2.jar: 731 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 4
|
||||
classes calling a removal-deprecated Unsafe method: 4 (210 call sites, 20 distinct methods)
|
||||
methods: {arrayBaseOffset=2, arrayIndexScale=1, copyMemory=2, getBoolean=1, getByte=2, getDouble=1, getFloat=1, getInt=16, getLong=10, getObject=95, objectFieldOffset=5, putBoolean=1, putByte=2, putDouble=1, putFloat=1, putInt=34, putLong=5, putObject=28, staticFieldBase=1, staticFieldOffset=1}
|
||||
other (not deprecated for removal) Unsafe methods called: [allocateInstance]
|
||||
|
||||
snappy-java-1.1.10.12.jar: 40 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 1
|
||||
classes calling a removal-deprecated Unsafe method: 0 (0 call sites, 0 distinct methods)
|
||||
|
||||
spark-unsafe_2.13-4.3.0.jar: 66 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 1
|
||||
classes calling a removal-deprecated Unsafe method: 1 (35 call sites, 24 distinct methods)
|
||||
methods: {allocateMemory=2, arrayBaseOffset=7, copyMemory=2, freeMemory=1, getBoolean=2, getByte=1, getDouble=1, getFloat=1, getInt=1, getLong=2, getObjectVolatile=1, getShort=1, objectFieldOffset=1, putBoolean=1, putByte=1, putDouble=1, putFloat=1, putInt=1, putLong=1, putObjectVolatile=1, putShort=1, setMemory=2, staticFieldBase=1, staticFieldOffset=1}
|
||||
other (not deprecated for removal) Unsafe methods called: [throwException]
|
||||
@@ -0,0 +1,11 @@
|
||||
$ jdeps --jdk-internals netty-common-4.1.140.Final.jar (excerpt)
|
||||
netty-common-4.1.140.Final.jar -> jdk.unsupported
|
||||
io.netty.util.internal.CleanerJava9 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
|
||||
io.netty.util.internal.CleanerJava9$1 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
|
||||
io.netty.util.internal.CleanerJava9$2 -> sun.misc.Unsafe JDK internal API (jdk.unsupported)
|
||||
JDK Internal API Suggested Replacement
|
||||
---------------- ---------------------
|
||||
sun.misc.Unsafe See https://openjdk.org/jeps/260
|
||||
|
||||
$ jdeps --jdk-internals netty-common-4.1.140.Final.jar | grep -c -- '-> sun.misc.Unsafe'
|
||||
27
|
||||
@@ -0,0 +1,48 @@
|
||||
$ java -cp netty-4.1.140.Final NettyProbe (JDK 25 default)
|
||||
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
||||
WARNING: sun.misc.Unsafe::allocateMemory has been called by io.netty.util.internal.PlatformDependent0$2 (file:<lib>/netty-common-4.1.140.Final.jar)
|
||||
WARNING: Please consider reporting this to the maintainers of class io.netty.util.internal.PlatformDependent0$2
|
||||
WARNING: sun.misc.Unsafe::allocateMemory will be removed in a future release
|
||||
netty sees Unsafe: true
|
||||
direct=true hasMemoryAddress=true readLong=cafebabe
|
||||
done
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=allow -cp netty-4.1.140.Final NettyProbe
|
||||
netty sees Unsafe: true
|
||||
direct=true hasMemoryAddress=true readLong=cafebabe
|
||||
done
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=deny -cp netty-4.1.140.Final NettyProbe
|
||||
netty sees Unsafe: false
|
||||
direct=true hasMemoryAddress=false readLong=cafebabe
|
||||
done
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=debug -cp netty-4.1.140.Final NettyProbe
|
||||
netty sees Unsafe: false
|
||||
direct=true hasMemoryAddress=false readLong=cafebabe
|
||||
done
|
||||
|
||||
$ java -cp netty-4.2.20.Final NettyProbe (JDK 25 default)
|
||||
netty sees Unsafe: false
|
||||
direct=true hasMemoryAddress=true readLong=cafebabe
|
||||
done
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=allow -cp netty-4.2.20.Final NettyProbe
|
||||
netty sees Unsafe: true
|
||||
direct=true hasMemoryAddress=true readLong=cafebabe
|
||||
done
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=deny -cp netty-4.2.20.Final NettyProbe
|
||||
netty sees Unsafe: false
|
||||
direct=true hasMemoryAddress=true readLong=cafebabe
|
||||
done
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=debug -cp netty-4.2.20.Final NettyProbe
|
||||
netty sees Unsafe: false
|
||||
direct=true hasMemoryAddress=true readLong=cafebabe
|
||||
done
|
||||
|
||||
$ unzip -p netty-common-4.1.140.Final.jar io/netty/util/internal/PlatformDependent0.class | grep -a -o -F 'sun.misc.unsafe.memory.access'
|
||||
sun.misc.unsafe.memory.access
|
||||
$ unzip -p netty-common-4.2.20.Final.jar io/netty/util/internal/PlatformDependent0.class | grep -a -o -F 'sun.misc.unsafe.memory.access'
|
||||
sun.misc.unsafe.memory.access
|
||||
@@ -0,0 +1,42 @@
|
||||
$ java --sun-misc-unsafe-memory-access=allow -cp build Equivalence (Unsafe, VarHandle and FFM side by side)
|
||||
field CAS: Unsafe and the replacement gave the same 2000-step trace
|
||||
field getAndAdd: 4 threads x 100000 -> total 400000 on every implementation
|
||||
off-heap array: Unsafe and the replacement gave the same 2000-step trace
|
||||
off-heap getAndAdd: 4 threads x 100000 -> sum 400000 on every implementation
|
||||
copyFrom / clear: identical on every implementation
|
||||
byte[] long access at offsets 0..32: Unsafe and VarHandle view agree
|
||||
VarHandle view at offset 36 of a 40-byte array: ArrayIndexOutOfBoundsException
|
||||
FFM read of element 4 in a 4-element segment: IndexOutOfBoundsException
|
||||
FFM read after close: IllegalStateException: Already closed
|
||||
ALL 170 CHECKS PASSED
|
||||
exit=0
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=deny -cp build Equivalence --new-only (replacements only)
|
||||
field CAS: the replacement alone gave the same 2000-step trace
|
||||
field getAndAdd: 4 threads x 100000 -> total 400000 on every implementation
|
||||
off-heap array: the replacement alone gave the same 2000-step trace
|
||||
off-heap getAndAdd: 4 threads x 100000 -> sum 400000 on every implementation
|
||||
copyFrom / clear: identical on every implementation
|
||||
byte[] long access at offsets 0..32: VarHandle view only
|
||||
VarHandle view at offset 36 of a 40-byte array: ArrayIndexOutOfBoundsException
|
||||
FFM read of element 4 in a 4-element segment: IndexOutOfBoundsException
|
||||
FFM read after close: IllegalStateException: Already closed
|
||||
ALL 67 CHECKS PASSED (new APIs only)
|
||||
exit=0
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=deny -cp build Equivalence (the Unsafe version under deny)
|
||||
Exception in thread "main" java.lang.ExceptionInInitializerError
|
||||
at Equivalence.main(Equivalence.java:25)
|
||||
Caused by: java.lang.UnsupportedOperationException: objectFieldOffset
|
||||
at jdk.unsupported/sun.misc.Unsafe.beforeMemoryAccessSlow(Unsafe.java:1822)
|
||||
at jdk.unsupported/sun.misc.Unsafe.beforeMemoryAccess(Unsafe.java:1787)
|
||||
at jdk.unsupported/sun.misc.Unsafe.objectFieldOffset(Unsafe.java:905)
|
||||
|
||||
$ java -cp build Equivalence (JDK 25 default: one warning, then the same results)
|
||||
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
||||
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by UnsafeFieldCounter (file:<build>/m/)
|
||||
WARNING: Please consider reporting this to the maintainers of class UnsafeFieldCounter
|
||||
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
|
||||
field CAS: Unsafe and the replacement gave the same 2000-step trace
|
||||
field getAndAdd: 4 threads x 100000 -> total 400000 on every implementation
|
||||
off-heap array: Unsafe and the replacement gave the same 2000-step trace
|
||||
@@ -0,0 +1,14 @@
|
||||
$ java -XX:StartFlightRecording:filename=probe.jfr --sun-misc-unsafe-memory-access=allow -cp build Probe (silent: no warnings)
|
||||
got Unsafe instance
|
||||
read back 42
|
||||
allocate/put/get/free all succeeded
|
||||
second use read 7
|
||||
$ jfr print --events jdk.DeprecatedInvocation probe.jfr | grep -E 'method = |line:' | sort | uniq -c
|
||||
1 Probe.main(String[]) line: 12
|
||||
1 Probe.main(String[]) line: 13
|
||||
1 Probe.main(String[]) line: 14
|
||||
1 Probe.main(String[]) line: 15
|
||||
1 method = sun.misc.Unsafe.allocateMemory(long)
|
||||
1 method = sun.misc.Unsafe.freeMemory(long)
|
||||
1 method = sun.misc.Unsafe.getLong(long)
|
||||
1 method = sun.misc.Unsafe.putLong(long, long)
|
||||
@@ -0,0 +1,75 @@
|
||||
sha1 ok com.google.guava:guava:33.8.0-jre
|
||||
sha1 ok com.esotericsoftware:kryo:5.7.1
|
||||
sha1 ok org.apache.hadoop:hadoop-common:3.5.0
|
||||
sha1 ok org.apache.cassandra:cassandra-all:5.0.9
|
||||
sha1 ok com.google.protobuf:protobuf-java:4.36.2
|
||||
sha1 ok org.apache.spark:spark-unsafe_2.13:4.3.0
|
||||
|
||||
this JDK: sun.misc.Unsafe has 86 public methods, 83 deprecated for removal
|
||||
|
||||
guava-33.8.0-jre.jar: 1972 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 5
|
||||
classes calling a removal-deprecated Unsafe method: 5 (22 call sites, 8 distinct methods)
|
||||
methods: {arrayBaseOffset=2, arrayIndexScale=2, compareAndSwapObject=3, getAndSetObject=2, getLong=4, objectFieldOffset=5, putLong=2, putObject=2}
|
||||
other (not deprecated for removal) Unsafe methods called: [getUnsafe]
|
||||
com.google.common.hash.LittleEndianByteArray$UnsafeByteArray 2
|
||||
com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$1 2
|
||||
com.google.common.hash.LittleEndianByteArray$UnsafeByteArray$2 2
|
||||
com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator 4
|
||||
com.google.common.util.concurrent.AbstractFutureState$UnsafeAtomicHelper 12
|
||||
|
||||
kryo-5.7.1.jar: 246 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 15
|
||||
classes calling a removal-deprecated Unsafe method: 15 (100 call sites, 20 distinct methods)
|
||||
methods: {copyMemory=4, getBoolean=2, getByte=10, getChar=4, getDouble=4, getFloat=4, getInt=5, getLong=5, getObject=5, getShort=4, objectFieldOffset=11, putBoolean=2, putByte=10, putChar=4, putDouble=4, putFloat=4, putInt=5, putLong=5, putObject=4, putShort=4}
|
||||
com.esotericsoftware.kryo.serializers.UnsafeField 5
|
||||
com.esotericsoftware.kryo.serializers.UnsafeField$BooleanUnsafeField 5
|
||||
com.esotericsoftware.kryo.serializers.UnsafeField$ByteUnsafeField 5
|
||||
com.esotericsoftware.kryo.serializers.UnsafeField$CharUnsafeField 5
|
||||
com.esotericsoftware.kryo.serializers.UnsafeField$DoubleUnsafeField 5
|
||||
com.esotericsoftware.kryo.serializers.UnsafeField$FloatUnsafeField 5
|
||||
com.esotericsoftware.kryo.serializers.UnsafeField$IntUnsafeField 7
|
||||
com.esotericsoftware.kryo.serializers.UnsafeField$LongUnsafeField 7
|
||||
com.esotericsoftware.kryo.serializers.UnsafeField$ShortUnsafeField 5
|
||||
com.esotericsoftware.kryo.serializers.UnsafeField$StringUnsafeField 5
|
||||
com.esotericsoftware.kryo.unsafe.UnsafeByteBufferInput 11
|
||||
com.esotericsoftware.kryo.unsafe.UnsafeByteBufferOutput 11
|
||||
com.esotericsoftware.kryo.unsafe.UnsafeInput 11
|
||||
com.esotericsoftware.kryo.unsafe.UnsafeOutput 11
|
||||
com.esotericsoftware.kryo.unsafe.UnsafeUtil 2
|
||||
|
||||
hadoop-common-3.5.0.jar: 2633 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 4
|
||||
classes calling a removal-deprecated Unsafe method: 1 (4 call sites, 3 distinct methods)
|
||||
methods: {arrayBaseOffset=1, arrayIndexScale=1, getLong=2}
|
||||
other (not deprecated for removal) Unsafe methods called: [pageSize]
|
||||
org.apache.hadoop.io.FastByteComparisons$LexicographicalComparerHolder$UnsafeComparer 4
|
||||
|
||||
cassandra-all-5.0.9.jar: 5770 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 7
|
||||
classes calling a removal-deprecated Unsafe method: 6 (152 call sites, 16 distinct methods)
|
||||
methods: {arrayBaseOffset=3, arrayIndexScale=1, copyMemory=7, getByte=46, getInt=6, getLong=15, getObject=2, getObjectVolatile=1, getShort=3, objectFieldOffset=7, putByte=43, putInt=9, putLong=4, putObject=1, putShort=2, setMemory=2}
|
||||
other (not deprecated for removal) Unsafe methods called: [allocateInstance, getUnsafe, pageSize]
|
||||
org.apache.cassandra.io.util.Memory 5
|
||||
org.apache.cassandra.utils.FastByteOperations$UnsafeOperations 16
|
||||
org.apache.cassandra.utils.concurrent.Ref 3
|
||||
org.apache.cassandra.utils.memory.LittleEndianMemoryUtil 37
|
||||
org.apache.cassandra.utils.memory.MemoryUtil 29
|
||||
org.apache.cassandra.utils.memory.NativeEndianMemoryUtil 62
|
||||
|
||||
protobuf-java-4.36.2.jar: 731 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 4
|
||||
classes calling a removal-deprecated Unsafe method: 4 (210 call sites, 20 distinct methods)
|
||||
methods: {arrayBaseOffset=2, arrayIndexScale=1, copyMemory=2, getBoolean=1, getByte=2, getDouble=1, getFloat=1, getInt=16, getLong=10, getObject=95, objectFieldOffset=5, putBoolean=1, putByte=2, putDouble=1, putFloat=1, putInt=34, putLong=5, putObject=28, staticFieldBase=1, staticFieldOffset=1}
|
||||
other (not deprecated for removal) Unsafe methods called: [allocateInstance]
|
||||
com.google.protobuf.MessageSchema 182
|
||||
com.google.protobuf.UnsafeUtil 1
|
||||
com.google.protobuf.UnsafeUtil$JvmMemoryAccessor 18
|
||||
com.google.protobuf.UnsafeUtil$MemoryAccessor 9
|
||||
|
||||
spark-unsafe_2.13-4.3.0.jar: 66 classes scanned
|
||||
classes touching sun.misc.Unsafe (call, or the strings 'sun.misc.Unsafe'/'theUnsafe'): 1
|
||||
classes calling a removal-deprecated Unsafe method: 1 (35 call sites, 24 distinct methods)
|
||||
methods: {allocateMemory=2, arrayBaseOffset=7, copyMemory=2, freeMemory=1, getBoolean=2, getByte=1, getDouble=1, getFloat=1, getInt=1, getLong=2, getObjectVolatile=1, getShort=1, objectFieldOffset=1, putBoolean=1, putByte=1, putDouble=1, putFloat=1, putInt=1, putLong=1, putObjectVolatile=1, putShort=1, setMemory=2, staticFieldBase=1, staticFieldOffset=1}
|
||||
other (not deprecated for removal) Unsafe methods called: [throwException]
|
||||
org.apache.spark.unsafe.Platform 35
|
||||
@@ -0,0 +1,45 @@
|
||||
$ java -cp guava-32.1.3-jre GuavaProbe (JDK 25 default)
|
||||
murmur3_128 = 1df72d8cb9e9c0755a1e5df367505d00
|
||||
WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
|
||||
WARNING: sun.misc.Unsafe::arrayBaseOffset has been called by com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator (file:<lib>/guava-32.1.3-jre.jar)
|
||||
WARNING: Please consider reporting this to the maintainers of class com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator
|
||||
WARNING: sun.misc.Unsafe::arrayBaseOffset will be removed in a future release
|
||||
comparator = com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator
|
||||
compare = -1
|
||||
future = ok
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=debug -cp guava-32.1.3-jre GuavaProbe
|
||||
murmur3_128 = 1df72d8cb9e9c0755a1e5df367505d00
|
||||
WARNING: sun.misc.Unsafe::arrayBaseOffset called by com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator (file:<lib>/guava-32.1.3-jre.jar)
|
||||
at com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$UnsafeComparator.<clinit>(UnsignedBytes.java:317)
|
||||
at java.base/java.lang.Class.forName0(Native Method)
|
||||
at java.base/java.lang.Class.forName(Class.java:467)
|
||||
at java.base/java.lang.Class.forName(Class.java:458)
|
||||
at com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder.getBestComparator(UnsignedBytes.java:437)
|
||||
at com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder.<clinit>(UnsignedBytes.java:290)
|
||||
at com.google.common.primitives.UnsignedBytes.lexicographicalComparator(UnsignedBytes.java:270)
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=deny -cp guava-32.1.3-jre GuavaProbe
|
||||
murmur3_128 = 1df72d8cb9e9c0755a1e5df367505d00
|
||||
comparator = com.google.common.primitives.UnsignedBytes$LexicographicalComparatorHolder$PureJavaComparator
|
||||
compare = -1
|
||||
future = ok
|
||||
|
||||
$ java -cp guava-33.8.0-jre GuavaProbe (JDK 25 default)
|
||||
murmur3_128 = 1df72d8cb9e9c0755a1e5df367505d00
|
||||
comparator = com.google.common.primitives.UnsignedBytes$ArraysCompareUnsignedComparator
|
||||
compare = -1
|
||||
future = ok
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=debug -cp guava-33.8.0-jre GuavaProbe
|
||||
murmur3_128 = 1df72d8cb9e9c0755a1e5df367505d00
|
||||
comparator = com.google.common.primitives.UnsignedBytes$ArraysCompareUnsignedComparator
|
||||
compare = -1
|
||||
future = ok
|
||||
|
||||
$ java --sun-misc-unsafe-memory-access=deny -cp guava-33.8.0-jre GuavaProbe
|
||||
murmur3_128 = 1df72d8cb9e9c0755a1e5df367505d00
|
||||
comparator = com.google.common.primitives.UnsignedBytes$ArraysCompareUnsignedComparator
|
||||
compare = -1
|
||||
future = ok
|
||||
|
||||
Reference in New Issue
Block a user