8316160: Remove sun.misc.Unsafe.{shouldBeInitialized,ensureClassInitialized}

Reviewed-by: rriggs, mchung, jpai
This commit is contained in:
Alan Bateman 2023-09-15 09:09:21 +00:00
parent 86dde5e02b
commit 25f32f3538

@ -727,42 +727,6 @@ public final class Unsafe {
return theInternalUnsafe.staticFieldBase(f);
}
/**
* Detects if the given class may need to be initialized. This is often
* needed in conjunction with obtaining the static field base of a
* class.
*
* @deprecated No replacement API for this method. As multiple threads
* may be trying to initialize the same class or interface at the same time.
* The only reliable result returned by this method is {@code false}
* indicating that the given class has been initialized. Instead, simply
* call {@link java.lang.invoke.MethodHandles.Lookup#ensureInitialized(Class)}
* that does nothing if the given class has already been initialized.
* This method is subject to removal in a future version of JDK.
*
* @return false only if a call to {@code ensureClassInitialized} would have no effect
*
*/
@Deprecated(since = "15", forRemoval = true)
@ForceInline
public boolean shouldBeInitialized(Class<?> c) {
return theInternalUnsafe.shouldBeInitialized(c);
}
/**
* Ensures the given class has been initialized. This is often
* needed in conjunction with obtaining the static field base of a
* class.
*
* @deprecated Use the {@link java.lang.invoke.MethodHandles.Lookup#ensureInitialized(Class)}
* method instead. This method is subject to removal in a future version of JDK.
*/
@Deprecated(since = "15", forRemoval = true)
@ForceInline
public void ensureClassInitialized(Class<?> c) {
theInternalUnsafe.ensureClassInitialized(c);
}
/**
* Reports the offset of the first element in the storage allocation of a
* given array class. If {@link #arrayIndexScale} returns a non-zero value