diff --git a/library/common/src/main/java/com/google/android/exoplayer2/util/Assertions.java b/library/common/src/main/java/com/google/android/exoplayer2/util/Assertions.java index aae75620c1..64496358cf 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/util/Assertions.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/util/Assertions.java @@ -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 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 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 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 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) { diff --git a/library/common/src/main/java/com/google/android/exoplayer2/util/BundleUtil.java b/library/common/src/main/java/com/google/android/exoplayer2/util/BundleUtil.java index 2fd251a168..fcf07a8901 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/util/BundleUtil.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/util/BundleUtil.java @@ -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; diff --git a/library/common/src/main/java/com/google/android/exoplayer2/util/ListenerSet.java b/library/common/src/main/java/com/google/android/exoplayer2/util/ListenerSet.java index 6dbceee659..ef93939a81 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/util/ListenerSet.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/util/ListenerSet.java @@ -102,7 +102,7 @@ public final class ListenerSet { 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; } diff --git a/library/common/src/main/java/com/google/android/exoplayer2/util/ParsableNalUnitBitArray.java b/library/common/src/main/java/com/google/android/exoplayer2/util/ParsableNalUnitBitArray.java index 2a3acc4b35..50810bc6a0 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/util/ParsableNalUnitBitArray.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/util/ParsableNalUnitBitArray.java @@ -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); } diff --git a/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java b/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java index 4f541118ff..5f914d529d 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/util/Util.java @@ -335,24 +335,14 @@ public final class Util { * *

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 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[] 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[] 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[] 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[] 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()) { diff --git a/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java b/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java index 629305485e..38448f61b6 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadHelper.java @@ -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; diff --git a/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java b/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java index 138f558362..95705a9caa 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java @@ -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 diff --git a/library/core/src/main/java/com/google/android/exoplayer2/offline/ProgressiveDownloader.java b/library/core/src/main/java/com/google/android/exoplayer2/offline/ProgressiveDownloader.java index ba6c2768de..5be5ea785d 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/offline/ProgressiveDownloader.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/offline/ProgressiveDownloader.java @@ -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); diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTimeBar.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTimeBar.java index 8d5ed5f805..2b0dce52d0 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTimeBar.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/DefaultTimeBar.java @@ -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, diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java index 173cc8d752..211dfffc44 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerControlView.java @@ -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, diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java index 1ba21c7526..0daa57d60c 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java @@ -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); } diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java index 16089d9022..ef7ab5cff1 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerView.java @@ -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); diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java index ce705daf63..7ced3faec4 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlView.java @@ -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, diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlViewLayoutManager.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlViewLayoutManager.java index 81ec217116..8c03272b3b 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlViewLayoutManager.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerControlViewLayoutManager.java @@ -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; diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java index 4873bb69ab..5995921c64 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/StyledPlayerView.java @@ -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); diff --git a/library/ui/src/main/java/com/google/android/exoplayer2/ui/TrackSelectionDialogBuilder.java b/library/ui/src/main/java/com/google/android/exoplayer2/ui/TrackSelectionDialogBuilder.java index 673a1f5117..86bb242864 100644 --- a/library/ui/src/main/java/com/google/android/exoplayer2/ui/TrackSelectionDialogBuilder.java +++ b/library/ui/src/main/java/com/google/android/exoplayer2/ui/TrackSelectionDialogBuilder.java @@ -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 {