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: 378184078
This commit is contained in:
olly 2021-06-08 18:16:48 +01:00 committed by Oliver Woodman
parent 1ca0efdd9b
commit 628ebeeb2b
9 changed files with 29 additions and 16 deletions

View File

@ -352,7 +352,7 @@ import java.util.concurrent.TimeoutException;
// TODO(internal b/160846312): Remove warning suppression and mark item @Nullable once we depend // TODO(internal b/160846312): Remove warning suppression and mark item @Nullable once we depend
// on media2 1.2.0. // on media2 1.2.0.
@Override @Override
@SuppressWarnings("nullness:override.param.invalid") @SuppressWarnings({"nullness:override.param.invalid", "nullness:override.param"})
public void onCurrentMediaItemChanged(SessionPlayer player, MediaItem item) { public void onCurrentMediaItemChanged(SessionPlayer player, MediaItem item) {
currentMediaItemBuffered = isBufferedState(player.getBufferingState()); currentMediaItemBuffered = isBufferedState(player.getBufferingState());
updateAllowedCommands(); updateAllowedCommands();

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") @SuppressWarnings({"nullness:method.invocation.invalid", "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.type.incompatible", "nullness:argument",
"nullness:method.invocation.invalid", "nullness:method.invocation.invalid", "nullness:method.invocation",
"nullness:methodref.receiver.bound.invalid" "nullness:methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"
}) })
public PlayerControlView( public PlayerControlView(
Context context, Context context,

View File

@ -704,7 +704,10 @@ 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("nullness:methodref.receiver.bound.invalid") @SuppressWarnings({
"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);
@ -1461,7 +1464,7 @@ public class PlayerNotificationManager {
return PendingIntent.getBroadcast(context, instanceId, intent, pendingFlags); return PendingIntent.getBroadcast(context, instanceId, intent, pendingFlags);
} }
@SuppressWarnings("nullness:argument.type.incompatible") @SuppressWarnings({"nullness:argument.type.incompatible", "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,7 +324,12 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
this(context, attrs, /* defStyleAttr= */ 0); this(context, attrs, /* defStyleAttr= */ 0);
} }
@SuppressWarnings({"nullness:argument.type.incompatible", "nullness:method.invocation.invalid"}) @SuppressWarnings({
"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.type.incompatible", "nullness:argument",
"nullness:assignment.type.incompatible", "nullness:assignment.type.incompatible", "nullness:assignment",
"nullness:method.invocation.invalid", "nullness:method.invocation.invalid", "nullness:method.invocation",
"nullness:methodref.receiver.bound.invalid" "nullness:methodref.receiver.bound.invalid", "nullness:methodref.receiver.bound"
}) })
public StyledPlayerControlView( public StyledPlayerControlView(
Context context, Context context,

View File

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

View File

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