Commit 4b30cca9 by olly Committed by bachinger

Update `@SuppressWarnings` annotations for go/nullness diagnostics

in preparation for upgrading the version of the Checker Framework in google3.

More information: go/checker-3110-lsc

PiperOrigin-RevId: 377925828
parent 71fb7411
Showing with 62 additions and 38 deletions
......@@ -169,7 +169,7 @@ public final class CronetEngineWrapper {
// Multi-catch can only be used for API 19+ in this case.
// Field#get(null) is blocked by the null-checker, but is safe because the field is static.
@SuppressWarnings({"UseMultiCatch", "nullness:argument.type.incompatible"})
@SuppressWarnings({"UseMultiCatch", "nullness:argument.type.incompatible", "nullness:argument"})
public CronetProviderComparator(boolean preferGMSCoreCronet) {
// GMSCore CronetProvider classes are only available in some configurations.
// Thus, we use reflection to copy static name.
......
......@@ -92,7 +92,7 @@ public final class FfmpegVideoRenderer extends DecoderVideoRenderer {
*/
}
@SuppressWarnings("return.type.incompatible")
@SuppressWarnings({"return.type.incompatible", "nullness:return"})
@Override
protected Decoder<VideoDecoderInputBuffer, VideoDecoderOutputBuffer, FfmpegDecoderException>
createDecoder(Format format, @Nullable ExoMediaCrypto mediaCrypto)
......
......@@ -177,7 +177,7 @@ public final class FlacExtractor implements Extractor {
}
@EnsuresNonNull({"decoderJni", "extractorOutput", "trackOutput"}) // Ensures initialized.
@SuppressWarnings({"contracts.postcondition.not.satisfied"})
@SuppressWarnings({"contracts.postcondition.not.satisfied", "nullness:contracts.postcondition"})
private FlacDecoderJni initDecoderJni(ExtractorInput input) {
FlacDecoderJni decoderJni = Assertions.checkNotNull(this.decoderJni);
decoderJni.setData(input);
......@@ -186,7 +186,7 @@ public final class FlacExtractor implements Extractor {
@RequiresNonNull({"decoderJni", "extractorOutput", "trackOutput"}) // Requires initialized.
@EnsuresNonNull({"streamMetadata", "outputFrameHolder"}) // Ensures stream metadata decoded.
@SuppressWarnings({"contracts.postcondition.not.satisfied"})
@SuppressWarnings({"contracts.postcondition.not.satisfied", "nullness:contracts.postcondition"})
private void decodeStreamMetadata(ExtractorInput input) throws IOException {
if (streamMetadataDecoded) {
return;
......
......@@ -211,7 +211,12 @@ import java.util.Map;
private long waitingForPreloadElapsedRealtimeMs;
/** Creates a new ad tag loader, starting the ad request if the ad tag is valid. */
@SuppressWarnings({"methodref.receiver.bound.invalid", "method.invocation.invalid"})
@SuppressWarnings({
"methodref.receiver.bound.invalid",
"nullness:methodref.receiver.bound",
"method.invocation.invalid",
"nullness:method.invocation"
})
public AdTagLoader(
Context context,
ImaUtil.Configuration configuration,
......
......@@ -734,7 +734,7 @@ public final class ImaAdsLoader implements Player.Listener, AdsLoader {
// The reasonDetail parameter to createFriendlyObstruction is annotated @Nullable but the
// annotation is not kept in the obfuscated dependency.
@SuppressWarnings("nullness:argument.type.incompatible")
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"})
@Override
public FriendlyObstruction createFriendlyObstruction(
View view,
......
......@@ -222,7 +222,7 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
}
}
@SuppressWarnings("nullness:argument.type.incompatible")
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"})
private static void removeSurfaceHolderCallback(SurfaceHolderGlueHost surfaceHolderGlueHost) {
surfaceHolderGlueHost.setSurfaceHolderCallback(null);
}
......
......@@ -357,14 +357,14 @@ public class PlaybackException extends Exception implements Bundleable {
}
// Creates a new {@link Throwable} with possibly {@code null} message.
@SuppressWarnings("nullness:argument.type.incompatible")
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"})
private static Throwable createThrowable(Class<?> clazz, @Nullable String message)
throws Exception {
return (Throwable) clazz.getConstructor(String.class).newInstance(message);
}
// Creates a new {@link RemoteException} with possibly {@code null} message.
@SuppressWarnings("nullness:argument.type.incompatible")
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"})
private static RemoteException createRemoteException(@Nullable String message) {
return new RemoteException(message);
}
......
......@@ -340,7 +340,7 @@ public final class AdPlaybackState implements Bundleable {
private static final int FIELD_IS_SERVER_SIDE_INSERTED = 6;
// putParcelableArrayList actually supports null elements.
@SuppressWarnings("nullness:argument.type.incompatible")
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"})
@Override
public Bundle toBundle() {
Bundle bundle = new Bundle();
......@@ -359,7 +359,7 @@ public final class AdPlaybackState implements Bundleable {
public static final Creator<AdGroup> CREATOR = AdGroup::fromBundle;
// getParcelableArrayList may have null elements.
@SuppressWarnings("nullness:type.argument.type.incompatible")
@SuppressWarnings({"nullness:type.argument.type.incompatible", "nullness:type.argument"})
private static AdGroup fromBundle(Bundle bundle) {
long timeUs = bundle.getLong(keyForField(FIELD_TIME_US));
int count = bundle.getInt(keyForField(FIELD_COUNT), /* defaultValue= */ C.LENGTH_UNSET);
......
......@@ -32,7 +32,7 @@ public abstract class AbstractConcatenatedTimeline extends Timeline {
* @param concatenatedUid UID of a period in a concatenated timeline.
* @return UID of the child timeline this period belongs to.
*/
@SuppressWarnings("nullness:return.type.incompatible")
@SuppressWarnings({"nullness:return.type.incompatible", "nullness:return"})
public static Object getChildTimelineUidFromConcatenatedUid(Object concatenatedUid) {
return ((Pair<?, ?>) concatenatedUid).first;
}
......@@ -43,7 +43,7 @@ public abstract class AbstractConcatenatedTimeline extends Timeline {
* @param concatenatedUid UID of a period in a concatenated timeline.
* @return UID of the period in the child timeline.
*/
@SuppressWarnings("nullness:return.type.incompatible")
@SuppressWarnings({"nullness:return.type.incompatible", "nullness:return"})
public static Object getChildPeriodUidFromConcatenatedUid(Object concatenatedUid) {
return ((Pair<?, ?>) concatenatedUid).second;
}
......
......@@ -526,7 +526,10 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
}
@EnsuresNonNullIf(result = true, expression = "sessionId")
@SuppressWarnings("contracts.conditional.postcondition.not.satisfied")
@SuppressWarnings({
"contracts.conditional.postcondition.not.satisfied",
"nullness:contracts.conditional.postcondition"
})
private boolean isOpen() {
return state == STATE_OPENED || state == STATE_OPENED_WITH_KEYS;
}
......
......@@ -822,7 +822,10 @@ public final class DownloadHelper {
"mediaPreparer.timeline",
"mediaPreparer.mediaPeriods"
})
@SuppressWarnings("nullness:contracts.postcondition.not.satisfied")
@SuppressWarnings({
"nullness:contracts.postcondition.not.satisfied",
"nullness:contracts.postcondition"
})
private void assertPreparedWithMedia() {
Assertions.checkState(isPreparedWithMedia);
}
......@@ -931,7 +934,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")
@SuppressWarnings({"methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"})
Handler downloadThreadHandler =
Util.createHandlerForCurrentOrMainLooper(this::handleDownloadHelperCallbackMessage);
this.downloadHelperHandler = downloadThreadHandler;
......
......@@ -255,7 +255,7 @@ public final class DownloadManager {
downloads = Collections.emptyList();
listeners = new CopyOnWriteArraySet<>();
@SuppressWarnings("methodref.receiver.bound.invalid")
@SuppressWarnings({"methodref.receiver.bound.invalid", "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")
@SuppressWarnings({"methodref.receiver.bound.invalid", "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")
@SuppressWarnings({"nullness:assignment.type.incompatible", "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
......
......@@ -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")
@SuppressWarnings({"methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"})
CacheWriter.ProgressListener progressListener = this::onProgress;
cacheWriter =
new CacheWriter(dataSource, dataSpec, /* temporaryBuffer= */ null, progressListener);
......
......@@ -162,8 +162,8 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
*/
// maybeFinishPrepare is not posted to the handler until initialization completes.
@SuppressWarnings({
"nullness:argument.type.incompatible",
"nullness:methodref.receiver.bound.invalid"
"nullness:argument.type.incompatible", "nullness:argument",
"nullness:methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"
})
public ProgressiveMediaPeriod(
Uri uri,
......@@ -980,7 +980,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
@Nullable private TrackOutput icyTrackOutput;
private boolean seenIcyMetadata;
@SuppressWarnings("method.invocation.invalid")
@SuppressWarnings({"method.invocation.invalid", "nullness:method.invocation"})
public ExtractingLoadable(
Uri uri,
DataSource dataSource,
......
......@@ -98,7 +98,7 @@ public final class ServerSideInsertedAdsMediaSource extends BaseMediaSource
* @param mediaSource The {@link MediaSource} to wrap.
*/
// Calling BaseMediaSource.createEventDispatcher from the constructor.
@SuppressWarnings("nullness:method.invocation.invalid")
@SuppressWarnings({"nullness:method.invocation.invalid", "nullness:method.invocation"})
public ServerSideInsertedAdsMediaSource(MediaSource mediaSource) {
this.mediaSource = mediaSource;
mediaPeriods = ArrayListMultimap.create();
......
......@@ -34,7 +34,7 @@ public abstract class BaseMediaChunkIterator implements MediaChunkIterator {
* @param fromIndex The first available index.
* @param toIndex The last available index.
*/
@SuppressWarnings("method.invocation.invalid")
@SuppressWarnings({"method.invocation.invalid", "nullness:method.invocation"})
public BaseMediaChunkIterator(long fromIndex, long toIndex) {
this.fromIndex = fromIndex;
this.toIndex = toIndex;
......
......@@ -29,7 +29,7 @@ public abstract class SimpleSubtitleDecoder
private final String name;
/** @param name The name of the decoder. */
@SuppressWarnings("nullness:method.invocation.invalid")
@SuppressWarnings({"nullness:method.invocation.invalid", "nullness:method.invocation"})
protected SimpleSubtitleDecoder(String name) {
super(new SubtitleInputBuffer[2], new SubtitleOutputBuffer[2]);
this.name = name;
......
......@@ -42,7 +42,10 @@ import java.util.PriorityQueue;
private long playbackPositionUs;
private long queuedInputBufferCount;
@SuppressWarnings("nullness:methodref.receiver.bound.invalid")
@SuppressWarnings({
"nullness:methodref.receiver.bound.invalid",
"nullness:methodref.receiver.bound"
})
public CeaDecoder() {
availableInputBuffers = new ArrayDeque<>();
for (int i = 0; i < NUM_INPUT_BUFFERS; i++) {
......
......@@ -51,7 +51,11 @@ public class TrackSelectionParameters implements Parcelable {
*
* @param context Any context.
*/
@SuppressWarnings({"deprecation", "nullness:method.invocation.invalid"})
@SuppressWarnings({
"deprecation",
"nullness:method.invocation.invalid",
"nullness:method.invocation"
})
public Builder(Context context) {
this();
setPreferredTextLanguageAndRoleFlagsToCaptioningManagerSettings(context);
......
......@@ -131,7 +131,7 @@ public final class EGLSurfaceTexture implements SurfaceTexture.OnFrameAvailableL
}
/** Releases all allocated resources. */
@SuppressWarnings({"nullness:argument.type.incompatible"})
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"})
public void release() {
handler.removeCallbacks(this);
try {
......
......@@ -161,7 +161,7 @@ public abstract class RunnableFutureTask<R, E extends Exception> implements Runn
// The return value is guaranteed to be non-null if and only if R is a non-null type, but there's
// no way to assert this. Suppress the warning instead.
@SuppressWarnings("return.type.incompatible")
@SuppressWarnings({"return.type.incompatible", "nullness:return"})
@UnknownNull
private R getResult() throws ExecutionException {
if (canceled) {
......
......@@ -53,9 +53,9 @@ public final class VideoDecoderGLSurfaceView extends GLSurfaceView
* @param attrs Custom attributes.
*/
@SuppressWarnings({
"nullness:assignment.type.incompatible",
"nullness:argument.type.incompatible",
"nullness:method.invocation.invalid"
"nullness:assignment.type.incompatible", "nullness:assignment",
"nullness:argument.type.incompatible", "nullness:argument",
"nullness:method.invocation.invalid", "nullness:method.invocation"
})
public VideoDecoderGLSurfaceView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
......
......@@ -70,8 +70,8 @@ import androidx.annotation.BinderThread;
private volatile float roll;
@SuppressWarnings({
"nullness:assignment.type.incompatible",
"nullness:argument.type.incompatible"
"nullness:assignment.type.incompatible", "nullness:assignment",
"nullness:argument.type.incompatible", "nullness:argument"
})
public TouchTracker(Context context, Listener listener, float pxPerDegrees) {
this.listener = listener;
......
......@@ -103,7 +103,7 @@ public final class DefaultExtractorsFactory implements ExtractorsFactory {
static {
@Nullable Constructor<? extends Extractor> flacExtensionExtractorConstructor = null;
try {
@SuppressWarnings("nullness:argument.type.incompatible")
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:argument"})
boolean isFlacNativeLibraryAvailable =
Boolean.TRUE.equals(
Class.forName("com.google.android.exoplayer2.ext.flac.FlacLibrary")
......
......@@ -237,10 +237,16 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
readOnlyMediaChunks = Collections.unmodifiableList(mediaChunks);
hlsSampleStreams = new ArrayList<>();
// Suppressions are needed because `this` is not initialized here.
@SuppressWarnings("nullness:methodref.receiver.bound.invalid")
@SuppressWarnings({
"nullness:methodref.receiver.bound.invalid",
"nullness:methodref.receiver.bound"
})
Runnable maybeFinishPrepareRunnable = this::maybeFinishPrepare;
this.maybeFinishPrepareRunnable = maybeFinishPrepareRunnable;
@SuppressWarnings("nullness:methodref.receiver.bound.invalid")
@SuppressWarnings({
"nullness:methodref.receiver.bound.invalid",
"nullness:methodref.receiver.bound"
})
Runnable onTracksEndedRunnable = this::onTracksEnded;
this.onTracksEndedRunnable = onTracksEndedRunnable;
handler = Util.createHandlerForCurrentLooper();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment