Remove obsolete Checker Framework suppression strings

More information: go/checker-3130-lsc

Tested:
    TAP for global presubmit queue passed after automated deflaking of failures: http://mondo/deflaker/run/ff80a4f9-d5d7-47ac-9560-63372e1ff624 http://mondo/deflaker/run/ca3ce61f-2af8-4fa7-b6e4-c98b5c4d950c
    http://test/OCL:379405669:BASE:379421861:1623763190392:bd2d256a
PiperOrigin-RevId: 379623080
This commit is contained in:
olly 2021-06-16 02:52:22 +01:00 committed by Oliver Woodman
parent a3dbd61239
commit 63f12f0216
16 changed files with 37 additions and 119 deletions

View File

@ -108,12 +108,7 @@ public final class Assertions {
* @return The non-null reference that was validated. * @return The non-null reference that was validated.
* @throws IllegalStateException If {@code reference} is null. * @throws IllegalStateException If {@code reference} is null.
*/ */
@SuppressWarnings({ @SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@EnsuresNonNull({"#1"}) @EnsuresNonNull({"#1"})
@Pure @Pure
public static <T> T checkStateNotNull(@Nullable T reference) { public static <T> T checkStateNotNull(@Nullable T reference) {
@ -133,12 +128,7 @@ public final class Assertions {
* @return The non-null reference that was validated. * @return The non-null reference that was validated.
* @throws IllegalStateException If {@code reference} is null. * @throws IllegalStateException If {@code reference} is null.
*/ */
@SuppressWarnings({ @SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@EnsuresNonNull({"#1"}) @EnsuresNonNull({"#1"})
@Pure @Pure
public static <T> T checkStateNotNull(@Nullable T reference, Object errorMessage) { public static <T> T checkStateNotNull(@Nullable T reference, Object errorMessage) {
@ -156,12 +146,7 @@ public final class Assertions {
* @return The non-null reference that was validated. * @return The non-null reference that was validated.
* @throws NullPointerException If {@code reference} is null. * @throws NullPointerException If {@code reference} is null.
*/ */
@SuppressWarnings({ @SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@EnsuresNonNull({"#1"}) @EnsuresNonNull({"#1"})
@Pure @Pure
public static <T> T checkNotNull(@Nullable T reference) { public static <T> T checkNotNull(@Nullable T reference) {
@ -181,12 +166,7 @@ public final class Assertions {
* @return The non-null reference that was validated. * @return The non-null reference that was validated.
* @throws NullPointerException If {@code reference} is null. * @throws NullPointerException If {@code reference} is null.
*/ */
@SuppressWarnings({ @SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@EnsuresNonNull({"#1"}) @EnsuresNonNull({"#1"})
@Pure @Pure
public static <T> T checkNotNull(@Nullable T reference, Object errorMessage) { public static <T> T checkNotNull(@Nullable T reference, Object errorMessage) {
@ -203,12 +183,7 @@ public final class Assertions {
* @return The non-null, non-empty string that was validated. * @return The non-null, non-empty string that was validated.
* @throws IllegalArgumentException If {@code string} is null or 0-length. * @throws IllegalArgumentException If {@code string} is null or 0-length.
*/ */
@SuppressWarnings({ @SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@EnsuresNonNull({"#1"}) @EnsuresNonNull({"#1"})
@Pure @Pure
public static String checkNotEmpty(@Nullable String string) { public static String checkNotEmpty(@Nullable String string) {
@ -227,12 +202,7 @@ public final class Assertions {
* @return The non-null, non-empty string that was validated. * @return The non-null, non-empty string that was validated.
* @throws IllegalArgumentException If {@code string} is null or 0-length. * @throws IllegalArgumentException If {@code string} is null or 0-length.
*/ */
@SuppressWarnings({ @SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@EnsuresNonNull({"#1"}) @EnsuresNonNull({"#1"})
@Pure @Pure
public static String checkNotEmpty(@Nullable String string, Object errorMessage) { public static String checkNotEmpty(@Nullable String string, Object errorMessage) {

View File

@ -61,7 +61,7 @@ public final class BundleUtil {
} }
// Method.invoke may take null "key". // Method.invoke may take null "key".
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"}) @SuppressWarnings("nullness:argument")
@Nullable @Nullable
private static IBinder getBinderByReflection(Bundle bundle, @Nullable String key) { private static IBinder getBinderByReflection(Bundle bundle, @Nullable String key) {
@Nullable Method getIBinder = getIBinderMethod; @Nullable Method getIBinder = getIBinderMethod;
@ -85,7 +85,7 @@ public final class BundleUtil {
} }
// Method.invoke may take null "key" and "binder". // Method.invoke may take null "key" and "binder".
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"}) @SuppressWarnings("nullness:argument")
private static void putBinderByReflection( private static void putBinderByReflection(
Bundle bundle, @Nullable String key, @Nullable IBinder binder) { Bundle bundle, @Nullable String key, @Nullable IBinder binder) {
@Nullable Method putIBinder = putIBinderMethod; @Nullable Method putIBinder = putIBinderMethod;

View File

@ -102,7 +102,7 @@ public final class ListenerSet<T> {
flushingEvents = new ArrayDeque<>(); flushingEvents = new ArrayDeque<>();
queuedEvents = new ArrayDeque<>(); queuedEvents = new ArrayDeque<>();
// It's safe to use "this" because we don't send a message before exiting the constructor. // It's safe to use "this" because we don't send a message before exiting the constructor.
@SuppressWarnings({"methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"}) @SuppressWarnings("nullness:methodref.receiver.bound")
HandlerWrapper handler = clock.createHandler(looper, this::handleMessage); HandlerWrapper handler = clock.createHandler(looper, this::handleMessage);
this.handler = handler; this.handler = handler;
} }

View File

@ -35,11 +35,7 @@ public final class ParsableNalUnitBitArray {
* @param offset The byte offset in {@code data} to start reading from. * @param offset The byte offset in {@code data} to start reading from.
* @param limit The byte offset of the end of the bitstream in {@code data}. * @param limit The byte offset of the end of the bitstream in {@code data}.
*/ */
@SuppressWarnings({ @SuppressWarnings({"initialization.fields.uninitialized", "nullness:method.invocation"})
"initialization.fields.uninitialized",
"method.invocation.invalid",
"nullness:method.invocation"
})
public ParsableNalUnitBitArray(byte[] data, int offset, int limit) { public ParsableNalUnitBitArray(byte[] data, int offset, int limit) {
reset(data, offset, limit); reset(data, offset, limit);
} }

View File

@ -335,24 +335,14 @@ public final class Util {
* *
* <p>Use {@link Assertions#checkNotNull(Object)} to throw if the value is null. * <p>Use {@link Assertions#checkNotNull(Object)} to throw if the value is null.
*/ */
@SuppressWarnings({ @SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@EnsuresNonNull("#1") @EnsuresNonNull("#1")
public static <T> T castNonNull(@Nullable T value) { public static <T> T castNonNull(@Nullable T value) {
return value; return value;
} }
/** Casts a nullable type array to a non-null type array without runtime null check. */ /** Casts a nullable type array to a non-null type array without runtime null check. */
@SuppressWarnings({ @SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@EnsuresNonNull("#1") @EnsuresNonNull("#1")
public static <T> T[] castNonNullTypeArray(@NullableType T[] value) { public static <T> T[] castNonNullTypeArray(@NullableType T[] value) {
return value; return value;
@ -366,12 +356,7 @@ public final class Util {
* @param length The output array length. Must be less or equal to the length of the input array. * @param length The output array length. Must be less or equal to the length of the input array.
* @return The copied array. * @return The copied array.
*/ */
@SuppressWarnings({ @SuppressWarnings({"nullness:argument", "nullness:return"})
"nullness:argument.type.incompatible",
"nullness:argument",
"nullness:return.type.incompatible",
"nullness:return"
})
public static <T> T[] nullSafeArrayCopy(T[] input, int length) { public static <T> T[] nullSafeArrayCopy(T[] input, int length) {
Assertions.checkArgument(length <= input.length); Assertions.checkArgument(length <= input.length);
return Arrays.copyOf(input, length); return Arrays.copyOf(input, length);
@ -385,12 +370,7 @@ public final class Util {
* @param to The end of the range to be copied, exclusive. * @param to The end of the range to be copied, exclusive.
* @return The copied array. * @return The copied array.
*/ */
@SuppressWarnings({ @SuppressWarnings({"nullness:argument", "nullness:return"})
"nullness:argument.type.incompatible",
"nullness:argument",
"nullness:return.type.incompatible",
"nullness:return"
})
public static <T> T[] nullSafeArrayCopyOfRange(T[] input, int from, int to) { public static <T> T[] nullSafeArrayCopyOfRange(T[] input, int from, int to) {
Assertions.checkArgument(0 <= from); Assertions.checkArgument(0 <= from);
Assertions.checkArgument(to <= input.length); Assertions.checkArgument(to <= input.length);
@ -417,7 +397,7 @@ public final class Util {
* @param second The second array. * @param second The second array.
* @return The concatenated result. * @return The concatenated result.
*/ */
@SuppressWarnings({"nullness:assignment.type.incompatible", "nullness:assignment"}) @SuppressWarnings("nullness:assignment")
public static <T> T[] nullSafeArrayConcatenation(T[] first, T[] second) { public static <T> T[] nullSafeArrayConcatenation(T[] first, T[] second) {
T[] concatenation = Arrays.copyOf(first, first.length + second.length); T[] concatenation = Arrays.copyOf(first, first.length + second.length);
System.arraycopy( System.arraycopy(
@ -511,12 +491,7 @@ public final class Util {
* callback is required. * callback is required.
* @return A {@link Handler} with the specified callback on the current {@link Looper} thread. * @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
*/ */
@SuppressWarnings({ @SuppressWarnings({"nullness:argument", "nullness:return"})
"nullness:argument.type.incompatible",
"nullness:argument",
"nullness:return.type.incompatible",
"nullness:return"
})
public static Handler createHandler( public static Handler createHandler(
Looper looper, @Nullable Handler.@UnknownInitialization Callback callback) { Looper looper, @Nullable Handler.@UnknownInitialization Callback callback) {
return new Handler(looper, callback); return new Handler(looper, callback);
@ -1237,11 +1212,7 @@ public final class Util {
*/ */
// incompatible types in argument. // incompatible types in argument.
// dereference of possibly-null reference matcher.group(9) // dereference of possibly-null reference matcher.group(9)
@SuppressWarnings({ @SuppressWarnings({"nullness:argument", "nullness:dereference.of.nullable"})
"nullness:argument.type.incompatible",
"nullness:argument",
"nullness:dereference.of.nullable"
})
public static long parseXsDateTime(String value) throws ParserException { public static long parseXsDateTime(String value) throws ParserException {
Matcher matcher = XS_DATE_TIME_PATTERN.matcher(value); Matcher matcher = XS_DATE_TIME_PATTERN.matcher(value);
if (!matcher.matches()) { if (!matcher.matches()) {

View File

@ -822,10 +822,7 @@ public final class DownloadHelper {
"mediaPreparer.timeline", "mediaPreparer.timeline",
"mediaPreparer.mediaPeriods" "mediaPreparer.mediaPeriods"
}) })
@SuppressWarnings({ @SuppressWarnings("nullness:contracts.postcondition")
"nullness:contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition"
})
private void assertPreparedWithMedia() { private void assertPreparedWithMedia() {
Assertions.checkState(isPreparedWithMedia); Assertions.checkState(isPreparedWithMedia);
} }
@ -934,7 +931,7 @@ public final class DownloadHelper {
this.downloadHelper = downloadHelper; this.downloadHelper = downloadHelper;
allocator = new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE); allocator = new DefaultAllocator(true, C.DEFAULT_BUFFER_SEGMENT_SIZE);
pendingMediaPeriods = new ArrayList<>(); pendingMediaPeriods = new ArrayList<>();
@SuppressWarnings({"methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"}) @SuppressWarnings("nullness:methodref.receiver.bound")
Handler downloadThreadHandler = Handler downloadThreadHandler =
Util.createHandlerForCurrentOrMainLooper(this::handleDownloadHelperCallbackMessage); Util.createHandlerForCurrentOrMainLooper(this::handleDownloadHelperCallbackMessage);
this.downloadHelperHandler = downloadThreadHandler; this.downloadHelperHandler = downloadThreadHandler;

View File

@ -255,7 +255,7 @@ public final class DownloadManager {
downloads = Collections.emptyList(); downloads = Collections.emptyList();
listeners = new CopyOnWriteArraySet<>(); listeners = new CopyOnWriteArraySet<>();
@SuppressWarnings({"methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"}) @SuppressWarnings("nullness:methodref.receiver.bound")
Handler mainHandler = Util.createHandlerForCurrentOrMainLooper(this::handleMainMessage); Handler mainHandler = Util.createHandlerForCurrentOrMainLooper(this::handleMainMessage);
this.applicationHandler = mainHandler; this.applicationHandler = mainHandler;
HandlerThread internalThread = new HandlerThread("ExoPlayer:DownloadManager"); HandlerThread internalThread = new HandlerThread("ExoPlayer:DownloadManager");
@ -270,7 +270,7 @@ public final class DownloadManager {
minRetryCount, minRetryCount,
downloadsPaused); downloadsPaused);
@SuppressWarnings({"methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"}) @SuppressWarnings("nullness:methodref.receiver.bound")
RequirementsWatcher.Listener requirementsListener = this::onRequirementsStateChanged; RequirementsWatcher.Listener requirementsListener = this::onRequirementsStateChanged;
this.requirementsListener = requirementsListener; this.requirementsListener = requirementsListener;
requirementsWatcher = requirementsWatcher =
@ -1316,7 +1316,7 @@ public final class DownloadManager {
contentLength = C.LENGTH_UNSET; contentLength = C.LENGTH_UNSET;
} }
@SuppressWarnings({"nullness:assignment.type.incompatible", "nullness:assignment"}) @SuppressWarnings("nullness:assignment")
public void cancel(boolean released) { public void cancel(boolean released) {
if (released) { if (released) {
// Download threads are GC roots for as long as they're running. The time taken for // Download threads are GC roots for as long as they're running. The time taken for

View File

@ -77,7 +77,7 @@ public final class ProgressiveDownloader implements Downloader {
.setFlags(DataSpec.FLAG_ALLOW_CACHE_FRAGMENTATION) .setFlags(DataSpec.FLAG_ALLOW_CACHE_FRAGMENTATION)
.build(); .build();
dataSource = cacheDataSourceFactory.createDataSourceForDownloading(); dataSource = cacheDataSourceFactory.createDataSourceForDownloading();
@SuppressWarnings({"methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"}) @SuppressWarnings("nullness:methodref.receiver.bound")
CacheWriter.ProgressListener progressListener = this::onProgress; CacheWriter.ProgressListener progressListener = this::onProgress;
cacheWriter = cacheWriter =
new CacheWriter(dataSource, dataSpec, /* temporaryBuffer= */ null, progressListener); new CacheWriter(dataSource, dataSpec, /* temporaryBuffer= */ null, progressListener);

View File

@ -243,7 +243,7 @@ public class DefaultTimeBar extends View implements TimeBar {
} }
// Suppress warnings due to usage of View methods in the constructor. // Suppress warnings due to usage of View methods in the constructor.
@SuppressWarnings({"nullness:method.invocation.invalid", "nullness:method.invocation"}) @SuppressWarnings("nullness:method.invocation")
public DefaultTimeBar( public DefaultTimeBar(
Context context, Context context,
@Nullable AttributeSet attrs, @Nullable AttributeSet attrs,

View File

@ -361,9 +361,9 @@ public class PlayerControlView extends FrameLayout {
} }
@SuppressWarnings({ @SuppressWarnings({
"nullness:argument.type.incompatible", "nullness:argument", "nullness:argument",
"nullness:method.invocation.invalid", "nullness:method.invocation", "nullness:method.invocation",
"nullness:methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound" "nullness:methodref.receiver.bound"
}) })
public PlayerControlView( public PlayerControlView(
Context context, Context context,

View File

@ -704,10 +704,7 @@ public class PlayerNotificationManager {
// This fails the nullness checker because handleMessage() is 'called' while `this` is still // This fails the nullness checker because handleMessage() is 'called' while `this` is still
// @UnderInitialization. No tasks are scheduled on mainHandler before the constructor completes, // @UnderInitialization. No tasks are scheduled on mainHandler before the constructor completes,
// so this is safe and we can suppress the warning. // so this is safe and we can suppress the warning.
@SuppressWarnings({ @SuppressWarnings("nullness:methodref.receiver.bound")
"nullness:methodref.receiver.bound.invalid",
"nullness:methodref.receiver.bound"
})
Handler mainHandler = Util.createHandler(Looper.getMainLooper(), this::handleMessage); Handler mainHandler = Util.createHandler(Looper.getMainLooper(), this::handleMessage);
this.mainHandler = mainHandler; this.mainHandler = mainHandler;
notificationManager = NotificationManagerCompat.from(context); notificationManager = NotificationManagerCompat.from(context);
@ -1464,7 +1461,7 @@ public class PlayerNotificationManager {
return PendingIntent.getBroadcast(context, instanceId, intent, pendingFlags); return PendingIntent.getBroadcast(context, instanceId, intent, pendingFlags);
} }
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"}) @SuppressWarnings("nullness:argument")
private static void setLargeIcon(NotificationCompat.Builder builder, @Nullable Bitmap largeIcon) { private static void setLargeIcon(NotificationCompat.Builder builder, @Nullable Bitmap largeIcon) {
builder.setLargeIcon(largeIcon); builder.setLargeIcon(largeIcon);
} }

View File

@ -324,12 +324,7 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
this(context, attrs, /* defStyleAttr= */ 0); this(context, attrs, /* defStyleAttr= */ 0);
} }
@SuppressWarnings({ @SuppressWarnings({"nullness:argument", "nullness:method.invocation"})
"nullness:argument.type.incompatible",
"nullness:argument",
"nullness:method.invocation.invalid",
"nullness:method.invocation"
})
public PlayerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { public PlayerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);

View File

@ -470,10 +470,10 @@ public class StyledPlayerControlView extends FrameLayout {
} }
@SuppressWarnings({ @SuppressWarnings({
"nullness:argument.type.incompatible", "nullness:argument", "nullness:argument",
"nullness:assignment.type.incompatible", "nullness:assignment", "nullness:assignment",
"nullness:method.invocation.invalid", "nullness:method.invocation", "nullness:method.invocation",
"nullness:methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound" "nullness:methodref.receiver.bound"
}) })
public StyledPlayerControlView( public StyledPlayerControlView(
Context context, Context context,

View File

@ -83,10 +83,7 @@ import java.util.List;
private boolean needToShowBars; private boolean needToShowBars;
private boolean animationEnabled; private boolean animationEnabled;
@SuppressWarnings({ @SuppressWarnings({"nullness:method.invocation", "nullness:methodref.receiver.bound"})
"nullness:method.invocation.invalid", "nullness:method.invocation",
"nullness:methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"
})
public StyledPlayerControlViewLayoutManager(StyledPlayerControlView styledPlayerControlView) { public StyledPlayerControlViewLayoutManager(StyledPlayerControlView styledPlayerControlView) {
this.styledPlayerControlView = styledPlayerControlView; this.styledPlayerControlView = styledPlayerControlView;
showAllBarsRunnable = this::showAllBars; showAllBarsRunnable = this::showAllBars;

View File

@ -325,12 +325,7 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
this(context, attrs, /* defStyleAttr= */ 0); this(context, attrs, /* defStyleAttr= */ 0);
} }
@SuppressWarnings({ @SuppressWarnings({"nullness:argument", "nullness:method.invocation"})
"nullness:argument.type.incompatible",
"nullness:argument",
"nullness:method.invocation.invalid",
"nullness:method.invocation"
})
public StyledPlayerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { public StyledPlayerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);

View File

@ -256,7 +256,7 @@ public final class TrackSelectionDialogBuilder {
} }
// Reflection calls can't verify null safety of return values or parameters. // Reflection calls can't verify null safety of return values or parameters.
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"}) @SuppressWarnings("nullness:argument")
@Nullable @Nullable
private Dialog buildForAndroidX() { private Dialog buildForAndroidX() {
try { try {