Fix missing NonNull annotations for overriding methods

If the super method has the annotation on an argument, then
the overriding method should have it too.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=151440313
This commit is contained in:
olly 2017-03-28 05:55:12 -07:00 committed by Oliver Woodman
parent 1dcfae452a
commit e7a4c28dde
13 changed files with 30 additions and 16 deletions

View File

@ -21,6 +21,7 @@ import android.content.pm.PackageManager;
import android.net.Uri;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
@ -184,8 +185,8 @@ public class PlayerActivity extends Activity implements OnClickListener, ExoPlay
}
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions,
int[] grantResults) {
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
@NonNull int[] grantResults) {
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
initializePlayer();
} else {

View File

@ -23,6 +23,7 @@ import android.media.MediaDrm;
import android.media.NotProvisionedException;
import android.media.ResourceBusyException;
import android.media.UnsupportedSchemeException;
import android.support.annotation.NonNull;
import com.google.android.exoplayer2.util.Assertions;
import java.util.HashMap;
import java.util.Map;
@ -62,7 +63,8 @@ public final class FrameworkMediaDrm implements ExoMediaDrm<FrameworkMediaCrypto
final ExoMediaDrm.OnEventListener<? super FrameworkMediaCrypto> listener) {
mediaDrm.setOnEventListener(listener == null ? null : new MediaDrm.OnEventListener() {
@Override
public void onEvent(MediaDrm md, byte[] sessionId, int event, int extra, byte[] data) {
public void onEvent(@NonNull MediaDrm md, byte[] sessionId, int event, int extra,
byte[] data) {
listener.onEvent(FrameworkMediaDrm.this, sessionId, event, extra, data);
}
});

View File

@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.text;
import android.support.annotation.NonNull;
import com.google.android.exoplayer2.Format;
import com.google.android.exoplayer2.decoder.DecoderInputBuffer;
@ -35,7 +36,7 @@ public final class SubtitleInputBuffer extends DecoderInputBuffer
}
@Override
public int compareTo(SubtitleInputBuffer other) {
public int compareTo(@NonNull SubtitleInputBuffer other) {
long delta = timeUs - other.timeUs;
if (delta == 0) {
return 0;

View File

@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.text.cea;
import android.support.annotation.NonNull;
import android.text.Layout.Alignment;
import com.google.android.exoplayer2.text.Cue;
@ -55,7 +56,7 @@ import com.google.android.exoplayer2.text.Cue;
}
@Override
public int compareTo(Cea708Cue other) {
public int compareTo(@NonNull Cea708Cue other) {
if (other.priority < priority) {
return -1;
} else if (other.priority > priority) {

View File

@ -16,6 +16,7 @@
package com.google.android.exoplayer2.text.webvtt;
import android.graphics.Typeface;
import android.support.annotation.NonNull;
import android.text.Layout.Alignment;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
@ -476,7 +477,7 @@ import java.util.regex.Pattern;
}
@Override
public int compareTo(StyleMatch another) {
public int compareTo(@NonNull StyleMatch another) {
return this.score - another.score;
}

View File

@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.upstream;
import android.support.annotation.NonNull;
import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.util.Assertions;
import java.io.IOException;
@ -71,12 +72,12 @@ public final class DataSourceInputStream extends InputStream {
}
@Override
public int read(byte[] buffer) throws IOException {
public int read(@NonNull byte[] buffer) throws IOException {
return read(buffer, 0, buffer.length);
}
@Override
public int read(byte[] buffer, int offset, int length) throws IOException {
public int read(@NonNull byte[] buffer, int offset, int length) throws IOException {
Assertions.checkState(!closed);
checkOpened();
int bytesRead = dataSource.read(buffer, offset, length);

View File

@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.upstream.cache;
import android.support.annotation.NonNull;
import com.google.android.exoplayer2.C;
import java.io.File;
@ -95,7 +96,7 @@ public class CacheSpan implements Comparable<CacheSpan> {
}
@Override
public int compareTo(CacheSpan another) {
public int compareTo(@NonNull CacheSpan another) {
if (!key.equals(another.key)) {
return key.compareTo(another.key);
}

View File

@ -15,6 +15,7 @@
*/
package com.google.android.exoplayer2.upstream.cache;
import android.support.annotation.NonNull;
import android.util.Log;
import com.google.android.exoplayer2.extractor.ChunkIndex;
import java.util.Arrays;
@ -195,7 +196,7 @@ public final class CachedRegionTracker implements Cache.Listener {
}
@Override
public int compareTo(Region another) {
public int compareTo(@NonNull Region another) {
return startOffset < another.startOffset ? -1
: startOffset == another.startOffset ? 0 : 1;
}

View File

@ -16,6 +16,7 @@
package com.google.android.exoplayer2.util;
import android.support.annotation.NonNull;
import android.util.Log;
import java.io.File;
import java.io.FileInputStream;
@ -185,12 +186,12 @@ public final class AtomicFile {
}
@Override
public void write(byte[] b) throws IOException {
public void write(@NonNull byte[] b) throws IOException {
fileOutputStream.write(b);
}
@Override
public void write(byte[] b, int off, int len) throws IOException {
public void write(@NonNull byte[] b, int off, int len) throws IOException {
fileOutputStream.write(b, off, len);
}
}

View File

@ -25,6 +25,7 @@ import android.content.pm.PackageManager.NameNotFoundException;
import android.graphics.Point;
import android.net.Uri;
import android.os.Build;
import android.support.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;
import android.view.Display;
@ -199,7 +200,7 @@ public final class Util {
public static ExecutorService newSingleThreadExecutor(final String threadName) {
return Executors.newSingleThreadExecutor(new ThreadFactory() {
@Override
public Thread newThread(Runnable r) {
public Thread newThread(@NonNull Runnable r) {
return new Thread(r, threadName);
}
});

View File

@ -25,6 +25,7 @@ import android.media.MediaCrypto;
import android.media.MediaFormat;
import android.os.Handler;
import android.os.SystemClock;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.Surface;
import com.google.android.exoplayer2.C;
@ -823,7 +824,7 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
}
@Override
public void onFrameRendered(MediaCodec codec, long presentationTimeUs, long nanoTime) {
public void onFrameRendered(@NonNull MediaCodec codec, long presentationTimeUs, long nanoTime) {
if (this != tunnelingOnFrameRenderedListener) {
// Stale event.
return;

View File

@ -17,6 +17,7 @@ package com.google.android.exoplayer2.source.dash.manifest;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;
/**
* Uniquely identifies a {@link Representation} in a {@link DashManifest}.
@ -68,7 +69,7 @@ public final class RepresentationKey implements Parcelable, Comparable<Represent
// Comparable implementation.
@Override
public int compareTo(RepresentationKey o) {
public int compareTo(@NonNull RepresentationKey o) {
int result = periodIndex - o.periodIndex;
if (result == 0) {
result = adaptationSetIndex - o.adaptationSetIndex;

View File

@ -16,6 +16,7 @@
package com.google.android.exoplayer2.source.hls.playlist;
import android.support.annotation.IntDef;
import android.support.annotation.NonNull;
import com.google.android.exoplayer2.C;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@ -61,7 +62,7 @@ public final class HlsMediaPlaylist extends HlsPlaylist {
}
@Override
public int compareTo(Long relativeStartTimeUs) {
public int compareTo(@NonNull Long relativeStartTimeUs) {
return this.relativeStartTimeUs > relativeStartTimeUs
? 1 : (this.relativeStartTimeUs < relativeStartTimeUs ? -1 : 0);
}