Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 641374057
  • Loading branch information
cpovirk authored and Google Java Core Libraries committed Jun 7, 2024
1 parent d328b51 commit 635571e
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ private static final class RunnableExecutorPair {
}

// A version of the list that uses compare and swap to manage the stack without locks.
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
private static final class ExecutionListCAS {
static final Logger log = Logger.getLogger(ExecutionListCAS.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ public class AbstractFutureFallbackAtomicHelperTest extends TestCase {
* This classloader disallows {@link sun.misc.Unsafe}, which will prevent us from selecting our
* preferred strategy {@code UnsafeAtomicHelper}.
*/
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
private static final ClassLoader NO_UNSAFE =
getClassLoader(ImmutableSet.of(sun.misc.Unsafe.class.getName()));

/**
* This classloader disallows {@link sun.misc.Unsafe} and {@link AtomicReferenceFieldUpdater},
* which will prevent us from selecting our {@code SafeAtomicHelper} strategy.
*/
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
private static final ClassLoader NO_ATOMIC_REFERENCE_FIELD_UPDATER =
getClassLoader(
ImmutableSet.of(
Expand Down
2 changes: 1 addition & 1 deletion android/guava/src/com/google/common/cache/Striped64.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* striping on 64bit values. The class extends Number so that concrete subclasses must publicly do
* so.
*/
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
Expand Down Expand Up @@ -287,7 +288,6 @@ final void internalReset(long initialValue) {
*
* @return a sun.misc.Unsafe
*/
@SuppressWarnings("removal") // b/318391980
private static sun.misc.Unsafe getUnsafe() {
try {
return sun.misc.Unsafe.getUnsafe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ private interface LittleEndianBytes {
* Unsafe.theUnsafe is inaccessible, the attempt to load the nested class fails, and the outer
* class's static initializer can fall back on a non-Unsafe version.
*/
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
private enum UnsafeByteArray implements LittleEndianBytes {
// Do *not* change the order of these constants!
UNSAFE_LITTLE_ENDIAN {
Expand Down Expand Up @@ -169,7 +170,6 @@ public void putLongLittleEndian(byte[] array, int offset, long value) {
*
* @return an Unsafe instance if successful
*/
@SuppressWarnings("removal") // b/318391980
private static Unsafe getUnsafe() {
try {
return Unsafe.getUnsafe();
Expand Down
2 changes: 1 addition & 1 deletion android/guava/src/com/google/common/hash/Striped64.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
Expand Down Expand Up @@ -287,7 +288,6 @@ final void internalReset(long initialValue) {
*
* @return a sun.misc.Unsafe
*/
@SuppressWarnings("removal") // b/318391980
private static sun.misc.Unsafe getUnsafe() {
try {
return sun.misc.Unsafe.getUnsafe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ static class LexicographicalComparatorHolder {

static final Comparator<byte[]> BEST_COMPARATOR = getBestComparator();

@SuppressWarnings({"SunApi", "removal"}) // b/345822163
@VisibleForTesting
enum UnsafeComparator implements Comparator<byte[]> {
INSTANCE;
Expand Down Expand Up @@ -333,7 +334,6 @@ enum UnsafeComparator implements Comparator<byte[]> {
*
* @return a sun.misc.Unsafe
*/
@SuppressWarnings("removal") // b/318391980
private static sun.misc.Unsafe getUnsafe() {
try {
return sun.misc.Unsafe.getUnsafe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ abstract boolean casListeners(
* <p>Static initialization of this class will fail if the {@link sun.misc.Unsafe} object cannot
* be accessed.
*/
@SuppressWarnings({"sunapi", "removal"}) // b/318391980
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
private static final class UnsafeAtomicHelper extends AtomicHelper {
static final sun.misc.Unsafe UNSAFE;
static final long LISTENERS_OFFSET;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,7 @@ private static final class RunnableExecutorPair {
}

// A version of the list that uses compare and swap to manage the stack without locks.
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
private static final class ExecutionListCAS {
static final Logger log = Logger.getLogger(ExecutionListCAS.class.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ public class AbstractFutureFallbackAtomicHelperTest extends TestCase {
* This classloader disallows {@link sun.misc.Unsafe}, which will prevent us from selecting our
* preferred strategy {@code UnsafeAtomicHelper}.
*/
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
private static final ClassLoader NO_UNSAFE =
getClassLoader(ImmutableSet.of(sun.misc.Unsafe.class.getName()));

/**
* This classloader disallows {@link sun.misc.Unsafe} and {@link AtomicReferenceFieldUpdater},
* which will prevent us from selecting our {@code SafeAtomicHelper} strategy.
*/
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
private static final ClassLoader NO_ATOMIC_REFERENCE_FIELD_UPDATER =
getClassLoader(
ImmutableSet.of(
Expand Down
2 changes: 1 addition & 1 deletion guava/src/com/google/common/cache/Striped64.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* striping on 64bit values. The class extends Number so that concrete subclasses must publicly do
* so.
*/
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
@GwtIncompatible
@ElementTypesAreNonnullByDefault
abstract class Striped64 extends Number {
Expand Down Expand Up @@ -287,7 +288,6 @@ final void internalReset(long initialValue) {
*
* @return a sun.misc.Unsafe
*/
@SuppressWarnings("removal") // b/318391980
private static sun.misc.Unsafe getUnsafe() {
try {
return sun.misc.Unsafe.getUnsafe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ private interface LittleEndianBytes {
* Unsafe.theUnsafe is inaccessible, the attempt to load the nested class fails, and the outer
* class's static initializer can fall back on a non-Unsafe version.
*/
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
private enum UnsafeByteArray implements LittleEndianBytes {
// Do *not* change the order of these constants!
UNSAFE_LITTLE_ENDIAN {
Expand Down Expand Up @@ -169,7 +170,6 @@ public void putLongLittleEndian(byte[] array, int offset, long value) {
*
* @return an Unsafe instance if successful
*/
@SuppressWarnings("removal") // b/318391980
private static Unsafe getUnsafe() {
try {
return Unsafe.getUnsafe();
Expand Down
2 changes: 1 addition & 1 deletion guava/src/com/google/common/hash/Striped64.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*/
@GwtIncompatible
@ElementTypesAreNonnullByDefault
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
abstract class Striped64 extends Number {
/*
* This class maintains a lazily-initialized table of atomically
Expand Down Expand Up @@ -287,7 +288,6 @@ final void internalReset(long initialValue) {
*
* @return a sun.misc.Unsafe
*/
@SuppressWarnings("removal") // b/318391980
private static sun.misc.Unsafe getUnsafe() {
try {
return sun.misc.Unsafe.getUnsafe();
Expand Down
2 changes: 1 addition & 1 deletion guava/src/com/google/common/primitives/UnsignedBytes.java
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ static class LexicographicalComparatorHolder {

static final Comparator<byte[]> BEST_COMPARATOR = getBestComparator();

@SuppressWarnings({"SunApi", "removal"}) // b/345822163
@VisibleForTesting
enum UnsafeComparator implements Comparator<byte[]> {
INSTANCE;
Expand Down Expand Up @@ -333,7 +334,6 @@ enum UnsafeComparator implements Comparator<byte[]> {
*
* @return a sun.misc.Unsafe
*/
@SuppressWarnings("removal") // b/318391980
private static sun.misc.Unsafe getUnsafe() {
try {
return sun.misc.Unsafe.getUnsafe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ abstract boolean casListeners(
* <p>Static initialization of this class will fail if the {@link sun.misc.Unsafe} object cannot
* be accessed.
*/
@SuppressWarnings({"sunapi", "removal"}) // b/318391980
@SuppressWarnings({"SunApi", "removal"}) // b/345822163
private static final class UnsafeAtomicHelper extends AtomicHelper {
static final sun.misc.Unsafe UNSAFE;
static final long LISTENERS_OFFSET;
Expand Down

0 comments on commit 635571e

Please sign in to comment.