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.
* @throws IllegalStateException If {@code reference} is null.
*/
@SuppressWarnings({
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
@EnsuresNonNull({"#1"})
@Pure
public static <T> T checkStateNotNull(@Nullable T reference) {
@ -133,12 +128,7 @@ public final class Assertions {
* @return The non-null reference that was validated.
* @throws IllegalStateException If {@code reference} is null.
*/
@SuppressWarnings({
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
@EnsuresNonNull({"#1"})
@Pure
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.
* @throws NullPointerException If {@code reference} is null.
*/
@SuppressWarnings({
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
@EnsuresNonNull({"#1"})
@Pure
public static <T> T checkNotNull(@Nullable T reference) {
@ -181,12 +166,7 @@ public final class Assertions {
* @return The non-null reference that was validated.
* @throws NullPointerException If {@code reference} is null.
*/
@SuppressWarnings({
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
@EnsuresNonNull({"#1"})
@Pure
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.
* @throws IllegalArgumentException If {@code string} is null or 0-length.
*/
@SuppressWarnings({
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
@EnsuresNonNull({"#1"})
@Pure
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.
* @throws IllegalArgumentException If {@code string} is null or 0-length.
*/
@SuppressWarnings({
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
@EnsuresNonNull({"#1"})
@Pure
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".
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"})
@SuppressWarnings("nullness:argument")
@Nullable
private static IBinder getBinderByReflection(Bundle bundle, @Nullable String key) {
@Nullable Method getIBinder = getIBinderMethod;
@ -85,7 +85,7 @@ public final class BundleUtil {
}
// Method.invoke may take null "key" and "binder".
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"})
@SuppressWarnings("nullness:argument")
private static void putBinderByReflection(
Bundle bundle, @Nullable String key, @Nullable IBinder binder) {
@Nullable Method putIBinder = putIBinderMethod;

View File

@ -102,7 +102,7 @@ public final class ListenerSet<T> {
flushingEvents = new ArrayDeque<>();
queuedEvents = new ArrayDeque<>();
// 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);
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 limit The byte offset of the end of the bitstream in {@code data}.
*/
@SuppressWarnings({
"initialization.fields.uninitialized",
"method.invocation.invalid",
"nullness:method.invocation"
})
@SuppressWarnings({"initialization.fields.uninitialized", "nullness:method.invocation"})
public ParsableNalUnitBitArray(byte[] data, int offset, int 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.
*/
@SuppressWarnings({
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
@EnsuresNonNull("#1")
public static <T> T castNonNull(@Nullable T value) {
return value;
}
/** Casts a nullable type array to a non-null type array without runtime null check. */
@SuppressWarnings({
"contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition",
"return.type.incompatible",
"nullness:return"
})
@SuppressWarnings({"nullness:contracts.postcondition", "nullness:return"})
@EnsuresNonNull("#1")
public static <T> T[] castNonNullTypeArray(@NullableType T[] 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.
* @return The copied array.
*/
@SuppressWarnings({
"nullness:argument.type.incompatible",
"nullness:argument",
"nullness:return.type.incompatible",
"nullness:return"
})
@SuppressWarnings({"nullness:argument", "nullness:return"})
public static <T> T[] nullSafeArrayCopy(T[] input, int length) {
Assertions.checkArgument(length <= 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.
* @return The copied array.
*/
@SuppressWarnings({
"nullness:argument.type.incompatible",
"nullness:argument",
"nullness:return.type.incompatible",
"nullness:return"
})
@SuppressWarnings({"nullness:argument", "nullness:return"})
public static <T> T[] nullSafeArrayCopyOfRange(T[] input, int from, int to) {
Assertions.checkArgument(0 <= from);
Assertions.checkArgument(to <= input.length);
@ -417,7 +397,7 @@ public final class Util {
* @param second The second array.
* @return The concatenated result.
*/
@SuppressWarnings({"nullness:assignment.type.incompatible", "nullness:assignment"})
@SuppressWarnings("nullness:assignment")
public static <T> T[] nullSafeArrayConcatenation(T[] first, T[] second) {
T[] concatenation = Arrays.copyOf(first, first.length + second.length);
System.arraycopy(
@ -511,12 +491,7 @@ public final class Util {
* callback is required.
* @return A {@link Handler} with the specified callback on the current {@link Looper} thread.
*/
@SuppressWarnings({
"nullness:argument.type.incompatible",
"nullness:argument",
"nullness:return.type.incompatible",
"nullness:return"
})
@SuppressWarnings({"nullness:argument", "nullness:return"})
public static Handler createHandler(
Looper looper, @Nullable Handler.@UnknownInitialization Callback callback) {
return new Handler(looper, callback);
@ -1237,11 +1212,7 @@ public final class Util {
*/
// incompatible types in argument.
// dereference of possibly-null reference matcher.group(9)
@SuppressWarnings({
"nullness:argument.type.incompatible",
"nullness:argument",
"nullness:dereference.of.nullable"
})
@SuppressWarnings({"nullness:argument", "nullness:dereference.of.nullable"})
public static long parseXsDateTime(String value) throws ParserException {
Matcher matcher = XS_DATE_TIME_PATTERN.matcher(value);
if (!matcher.matches()) {

View File

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

View File

@ -255,7 +255,7 @@ public final class DownloadManager {
downloads = Collections.emptyList();
listeners = new CopyOnWriteArraySet<>();
@SuppressWarnings({"methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"})
@SuppressWarnings("nullness:methodref.receiver.bound")
Handler mainHandler = Util.createHandlerForCurrentOrMainLooper(this::handleMainMessage);
this.applicationHandler = mainHandler;
HandlerThread internalThread = new HandlerThread("ExoPlayer:DownloadManager");
@ -270,7 +270,7 @@ public final class DownloadManager {
minRetryCount,
downloadsPaused);
@SuppressWarnings({"methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"})
@SuppressWarnings("nullness:methodref.receiver.bound")
RequirementsWatcher.Listener requirementsListener = this::onRequirementsStateChanged;
this.requirementsListener = requirementsListener;
requirementsWatcher =
@ -1316,7 +1316,7 @@ public final class DownloadManager {
contentLength = C.LENGTH_UNSET;
}
@SuppressWarnings({"nullness:assignment.type.incompatible", "nullness:assignment"})
@SuppressWarnings("nullness:assignment")
public void cancel(boolean released) {
if (released) {
// 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)
.build();
dataSource = cacheDataSourceFactory.createDataSourceForDownloading();
@SuppressWarnings({"methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"})
@SuppressWarnings("nullness:methodref.receiver.bound")
CacheWriter.ProgressListener progressListener = this::onProgress;
cacheWriter =
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.
@SuppressWarnings({"nullness:method.invocation.invalid", "nullness:method.invocation"})
@SuppressWarnings("nullness:method.invocation")
public DefaultTimeBar(
Context context,
@Nullable AttributeSet attrs,

View File

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

View File

@ -704,10 +704,7 @@ public class PlayerNotificationManager {
// This fails the nullness checker because handleMessage() is 'called' while `this` is still
// @UnderInitialization. No tasks are scheduled on mainHandler before the constructor completes,
// so this is safe and we can suppress the warning.
@SuppressWarnings({
"nullness:methodref.receiver.bound.invalid",
"nullness:methodref.receiver.bound"
})
@SuppressWarnings("nullness:methodref.receiver.bound")
Handler mainHandler = Util.createHandler(Looper.getMainLooper(), this::handleMessage);
this.mainHandler = mainHandler;
notificationManager = NotificationManagerCompat.from(context);
@ -1464,7 +1461,7 @@ public class PlayerNotificationManager {
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) {
builder.setLargeIcon(largeIcon);
}

View File

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

View File

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

View File

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

View File

@ -325,12 +325,7 @@ public class StyledPlayerView extends FrameLayout implements AdViewProvider {
this(context, attrs, /* defStyleAttr= */ 0);
}
@SuppressWarnings({
"nullness:argument.type.incompatible",
"nullness:argument",
"nullness:method.invocation.invalid",
"nullness:method.invocation"
})
@SuppressWarnings({"nullness:argument", "nullness:method.invocation"})
public StyledPlayerView(Context context, @Nullable AttributeSet attrs, int 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.
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"})
@SuppressWarnings("nullness:argument")
@Nullable
private Dialog buildForAndroidX() {
try {