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

View File

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

View File

@ -46,7 +46,7 @@ public final class DefaultPlaybackSessionManager implements PlaybackSessionManag
private final Timeline.Period period; private final Timeline.Period period;
private final HashMap<String, SessionDescriptor> sessions; private final HashMap<String, SessionDescriptor> sessions;
@MonotonicNonNull private Listener listener; private @MonotonicNonNull Listener listener;
private Timeline currentTimeline; private Timeline currentTimeline;
@Nullable private MediaPeriodId currentMediaPeriodId; @Nullable private MediaPeriodId currentMediaPeriodId;
@Nullable private String activeSessionId; @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 * @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. * given time is before the first known playback state in the history.
*/ */
@PlaybackState public @PlaybackState int getPlaybackStateAtTime(long realtimeMs) {
public int getPlaybackStateAtTime(long realtimeMs) {
@PlaybackState int state = PLAYBACK_STATE_NOT_STARTED; @PlaybackState int state = PLAYBACK_STATE_NOT_STARTED;
for (Pair<EventTime, @PlaybackState Integer> timeAndState : playbackStateHistory) { for (Pair<EventTime, @PlaybackState Integer> timeAndState : playbackStateHistory) {
if (timeAndState.first.realtimeMs > realtimeMs) { if (timeAndState.first.realtimeMs > realtimeMs) {

View File

@ -452,7 +452,7 @@ public final class PlaybackStatsListener
private int nonFatalErrorCount; private int nonFatalErrorCount;
// Current player state tracking. // Current player state tracking.
@PlaybackState private int currentPlaybackState; private @PlaybackState int currentPlaybackState;
private long currentPlaybackStateStartTimeMs; private long currentPlaybackStateStartTimeMs;
private boolean isSeeking; private boolean isSeeking;
private boolean isForeground; 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. * @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) { public PlaybackStats build(boolean isFinal) {
long[] playbackStateDurationsMs = this.playbackStateDurationsMs; long[] playbackStateDurationsMs = this.playbackStateDurationsMs;
List<long[]> mediaTimeHistory = this.mediaTimeHistory; List<long[]> mediaTimeHistory = this.mediaTimeHistory;
@ -739,6 +737,10 @@ public final class PlaybackStatsListener
: playbackStateDurationsMs[PlaybackStats.PLAYBACK_STATE_JOINING_FOREGROUND]; : playbackStateDurationsMs[PlaybackStats.PLAYBACK_STATE_JOINING_FOREGROUND];
boolean hasBackgroundJoin = boolean hasBackgroundJoin =
playbackStateDurationsMs[PlaybackStats.PLAYBACK_STATE_JOINING_BACKGROUND] > 0; 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( return new PlaybackStats(
/* playbackCount= */ 1, /* playbackCount= */ 1,
playbackStateDurationsMs, playbackStateDurationsMs,
@ -757,8 +759,8 @@ public final class PlaybackStatsListener
rebufferCount, rebufferCount,
maxRebufferTimeMs, maxRebufferTimeMs,
/* adPlaybackCount= */ isAd ? 1 : 0, /* adPlaybackCount= */ isAd ? 1 : 0,
isFinal ? videoFormatHistory : new ArrayList<>(videoFormatHistory), videoHistory,
isFinal ? audioFormatHistory : new ArrayList<>(audioFormatHistory), audioHistory,
videoFormatHeightTimeMs, videoFormatHeightTimeMs,
videoFormatHeightTimeProduct, videoFormatHeightTimeProduct,
videoFormatBitrateTimeMs, videoFormatBitrateTimeMs,
@ -826,8 +828,7 @@ public final class PlaybackStatsListener
} }
} }
@PlaybackState private @PlaybackState int resolveNewPlaybackState() {
private int resolveNewPlaybackState() {
if (isSuspended) { if (isSuspended) {
// Keep VIDEO_STATE_ENDED if playback naturally ended (or progressed to next item). // Keep VIDEO_STATE_ENDED if playback naturally ended (or progressed to next item).
return currentPlaybackState == PlaybackStats.PLAYBACK_STATE_ENDED return currentPlaybackState == PlaybackStats.PLAYBACK_STATE_ENDED

View File

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

View File

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

View File

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

View File

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

View File

@ -75,7 +75,7 @@ public final class SimpleCache implements Cache {
private long uid; private long uid;
private long totalSpace; private long totalSpace;
private boolean released; 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 * 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 TrackNameProvider trackNameProvider;
private CheckedTextView[][] trackViews; private CheckedTextView[][] trackViews;
@MonotonicNonNull private MappedTrackInfo mappedTrackInfo; private @MonotonicNonNull MappedTrackInfo mappedTrackInfo;
private int rendererIndex; private int rendererIndex;
private TrackGroupArray trackGroups; private TrackGroupArray trackGroups;
private boolean isDisabled; 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 // 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 // and posts it. This marks the Surface as dirty. The GL code then updates the SurfaceTexture
// when rendering only if it is dirty. // when rendering only if it is dirty.
@MonotonicNonNull private SurfaceTexture displaySurfaceTexture; private @MonotonicNonNull SurfaceTexture displaySurfaceTexture;
@MonotonicNonNull private Surface displaySurface; private @MonotonicNonNull Surface displaySurface;
public CanvasRenderer() { public CanvasRenderer() {
vertexBuffer = GlUtil.createBuffer(COORDS_PER_VERTEX * VERTEX_COUNT); 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.GLES11Ext;
import android.opengl.GLES20; import android.opengl.GLES20;
import androidx.annotation.Nullable;
import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.util.GlUtil; import com.google.android.exoplayer2.util.GlUtil;
import com.google.android.exoplayer2.video.spherical.Projection; import com.google.android.exoplayer2.video.spherical.Projection;
import java.nio.FloatBuffer; 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 * Utility class to render spherical meshes for video or images. Call {@link #init()} on the GL