Fix checkerframework 2.8.2 warnings.

The updated version issues more warnings than before.
Most of the changes are related to annotation placement.

PiperOrigin-RevId: 255371743
This commit is contained in:
tonihei 2019-06-27 12:08:23 +01:00 committed by Oliver Woodman
parent 40d44c48e5
commit 8faac0344b
13 changed files with 39 additions and 39 deletions

View File

@ -110,20 +110,20 @@ public final class ReceiverAppStateUpdate {
public static final class Builder {
private final long sequenceNumber;
@MonotonicNonNull private Boolean playWhenReady;
@MonotonicNonNull private Integer playbackState;
@MonotonicNonNull private List<MediaItem> items;
@MonotonicNonNull private Integer repeatMode;
@MonotonicNonNull private Boolean shuffleModeEnabled;
@MonotonicNonNull private Boolean isLoading;
@MonotonicNonNull private PlaybackParameters playbackParameters;
@MonotonicNonNull private TrackSelectionParameters trackSelectionParameters;
@MonotonicNonNull private String errorMessage;
@MonotonicNonNull private Integer discontinuityReason;
@MonotonicNonNull private UUID currentPlayingItemUuid;
@MonotonicNonNull private String currentPlayingPeriodId;
@MonotonicNonNull private Long currentPlaybackPositionMs;
@MonotonicNonNull private List<Integer> shuffleOrder;
private @MonotonicNonNull Boolean playWhenReady;
private @MonotonicNonNull Integer playbackState;
private @MonotonicNonNull List<MediaItem> items;
private @MonotonicNonNull Integer repeatMode;
private @MonotonicNonNull Boolean shuffleModeEnabled;
private @MonotonicNonNull Boolean isLoading;
private @MonotonicNonNull PlaybackParameters playbackParameters;
private @MonotonicNonNull TrackSelectionParameters trackSelectionParameters;
private @MonotonicNonNull String errorMessage;
private @MonotonicNonNull Integer discontinuityReason;
private @MonotonicNonNull UUID currentPlayingItemUuid;
private @MonotonicNonNull String currentPlayingPeriodId;
private @MonotonicNonNull Long currentPlaybackPositionMs;
private @MonotonicNonNull List<Integer> shuffleOrder;
private Map<UUID, MediaItemInfo> mediaItemsInformation;
private Builder(long sequenceNumber) {

View File

@ -61,12 +61,12 @@ public abstract class GvrPlayerActivity extends GvrActivity {
private final Handler mainHandler;
@Nullable private Player player;
@MonotonicNonNull private GlViewGroup glView;
@MonotonicNonNull private ControllerManager controllerManager;
@MonotonicNonNull private SurfaceTexture surfaceTexture;
@MonotonicNonNull private Surface surface;
@MonotonicNonNull private SceneRenderer scene;
@MonotonicNonNull private PlayerControlView playerControl;
private @MonotonicNonNull GlViewGroup glView;
private @MonotonicNonNull ControllerManager controllerManager;
private @MonotonicNonNull SurfaceTexture surfaceTexture;
private @MonotonicNonNull Surface surface;
private @MonotonicNonNull SceneRenderer scene;
private @MonotonicNonNull PlayerControlView playerControl;
public GvrPlayerActivity() {
mainHandler = new Handler(Looper.getMainLooper());

View File

@ -46,7 +46,7 @@ public final class DefaultPlaybackSessionManager implements PlaybackSessionManag
private final Timeline.Period period;
private final HashMap<String, SessionDescriptor> sessions;
@MonotonicNonNull private Listener listener;
private @MonotonicNonNull Listener listener;
private Timeline currentTimeline;
@Nullable private MediaPeriodId currentMediaPeriodId;
@Nullable private String activeSessionId;

View File

@ -502,8 +502,7 @@ public final class PlaybackStats {
* @return The {@link PlaybackState} at that time, or {@link #PLAYBACK_STATE_NOT_STARTED} if the
* given time is before the first known playback state in the history.
*/
@PlaybackState
public int getPlaybackStateAtTime(long realtimeMs) {
public @PlaybackState int getPlaybackStateAtTime(long realtimeMs) {
@PlaybackState int state = PLAYBACK_STATE_NOT_STARTED;
for (Pair<EventTime, @PlaybackState Integer> timeAndState : playbackStateHistory) {
if (timeAndState.first.realtimeMs > realtimeMs) {

View File

@ -452,7 +452,7 @@ public final class PlaybackStatsListener
private int nonFatalErrorCount;
// Current player state tracking.
@PlaybackState private int currentPlaybackState;
private @PlaybackState int currentPlaybackState;
private long currentPlaybackStateStartTimeMs;
private boolean isSeeking;
private boolean isForeground;
@ -713,8 +713,6 @@ public final class PlaybackStatsListener
*
* @param isFinal Whether this is the final build and no further events are expected.
*/
// TODO(b/133387873): incompatible types in conditional expression.
@SuppressWarnings("nullness:conditional.type.incompatible")
public PlaybackStats build(boolean isFinal) {
long[] playbackStateDurationsMs = this.playbackStateDurationsMs;
List<long[]> mediaTimeHistory = this.mediaTimeHistory;
@ -739,6 +737,10 @@ public final class PlaybackStatsListener
: playbackStateDurationsMs[PlaybackStats.PLAYBACK_STATE_JOINING_FOREGROUND];
boolean hasBackgroundJoin =
playbackStateDurationsMs[PlaybackStats.PLAYBACK_STATE_JOINING_BACKGROUND] > 0;
List<Pair<EventTime, @NullableType Format>> videoHistory =
isFinal ? videoFormatHistory : new ArrayList<>(videoFormatHistory);
List<Pair<EventTime, @NullableType Format>> audioHistory =
isFinal ? audioFormatHistory : new ArrayList<>(audioFormatHistory);
return new PlaybackStats(
/* playbackCount= */ 1,
playbackStateDurationsMs,
@ -757,8 +759,8 @@ public final class PlaybackStatsListener
rebufferCount,
maxRebufferTimeMs,
/* adPlaybackCount= */ isAd ? 1 : 0,
isFinal ? videoFormatHistory : new ArrayList<>(videoFormatHistory),
isFinal ? audioFormatHistory : new ArrayList<>(audioFormatHistory),
videoHistory,
audioHistory,
videoFormatHeightTimeMs,
videoFormatHeightTimeProduct,
videoFormatBitrateTimeMs,
@ -826,8 +828,7 @@ public final class PlaybackStatsListener
}
}
@PlaybackState
private int resolveNewPlaybackState() {
private @PlaybackState int resolveNewPlaybackState() {
if (isSuspended) {
// Keep VIDEO_STATE_ENDED if playback naturally ended (or progressed to next item).
return currentPlaybackState == PlaybackStats.PLAYBACK_STATE_ENDED

View File

@ -39,7 +39,7 @@ public final class DecryptableSampleQueueReader {
private final DrmSessionManager<?> sessionManager;
private final FormatHolder formatHolder;
private final boolean playClearSamplesWithoutKeys;
@MonotonicNonNull private Format currentFormat;
private @MonotonicNonNull Format currentFormat;
@Nullable private DrmSession<?> currentSession;
/**

View File

@ -29,7 +29,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
*/
public final class ByteArrayDataSink implements DataSink {
@MonotonicNonNull private ByteArrayOutputStream stream;
private @MonotonicNonNull ByteArrayOutputStream stream;
@Override
public void open(DataSpec dataSpec) {

View File

@ -413,7 +413,7 @@ public final class DefaultBandwidthMeter implements BandwidthMeter, TransferList
*/
private static class ConnectivityActionReceiver extends BroadcastReceiver {
@MonotonicNonNull private static ConnectivityActionReceiver staticInstance;
private static @MonotonicNonNull ConnectivityActionReceiver staticInstance;
private final Handler mainHandler;
private final ArrayList<WeakReference<DefaultBandwidthMeter>> bandwidthMeters;

View File

@ -59,7 +59,7 @@ import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
private final DatabaseProvider databaseProvider;
@MonotonicNonNull private String tableName;
private @MonotonicNonNull String tableName;
/**
* Deletes index data for the specified cache.

View File

@ -75,7 +75,7 @@ public final class SimpleCache implements Cache {
private long uid;
private long totalSpace;
private boolean released;
@MonotonicNonNull private CacheException initializationException;
private @MonotonicNonNull CacheException initializationException;
/**
* Returns whether {@code cacheFolder} is locked by a {@link SimpleCache} instance. To unlock the

View File

@ -67,7 +67,7 @@ public class TrackSelectionView extends LinearLayout {
private TrackNameProvider trackNameProvider;
private CheckedTextView[][] trackViews;
@MonotonicNonNull private MappedTrackInfo mappedTrackInfo;
private @MonotonicNonNull MappedTrackInfo mappedTrackInfo;
private int rendererIndex;
private TrackGroupArray trackGroups;
private boolean isDisabled;

View File

@ -101,8 +101,8 @@ public final class CanvasRenderer {
// GL initialization. The client of this class acquires a Canvas from the Surface, writes to it
// and posts it. This marks the Surface as dirty. The GL code then updates the SurfaceTexture
// when rendering only if it is dirty.
@MonotonicNonNull private SurfaceTexture displaySurfaceTexture;
@MonotonicNonNull private Surface displaySurface;
private @MonotonicNonNull SurfaceTexture displaySurfaceTexture;
private @MonotonicNonNull Surface displaySurface;
public CanvasRenderer() {
vertexBuffer = GlUtil.createBuffer(COORDS_PER_VERTEX * VERTEX_COUNT);

View File

@ -19,11 +19,11 @@ import static com.google.android.exoplayer2.util.GlUtil.checkGlError;
import android.opengl.GLES11Ext;
import android.opengl.GLES20;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.util.GlUtil;
import com.google.android.exoplayer2.video.spherical.Projection;
import java.nio.FloatBuffer;
import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Utility class to render spherical meshes for video or images. Call {@link #init()} on the GL