Remove @Nullable
from Dumper.add
methods
`checkNotNull` was added to the `Object` variant in b83f12c4ba
. It
doesn't seem to have caused any test failures, so I guess we never
pass `null` in here - and might as well update the annotation to match
reality. And then for consistency we should ban `null` from the
`byte[]` overload too.
PiperOrigin-RevId: 628419003
This commit is contained in:
parent
38813dd30e
commit
e759b44c45
@ -15,6 +15,8 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.test.utils;
|
package androidx.media3.test.utils;
|
||||||
|
|
||||||
|
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.media3.common.ColorInfo;
|
import androidx.media3.common.ColorInfo;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
@ -154,6 +156,7 @@ public final class DumpableFormat implements Dumper.Dumpable {
|
|||||||
@Nullable Object fieldValue = getFieldFunction.apply(value);
|
@Nullable Object fieldValue = getFieldFunction.apply(value);
|
||||||
@Nullable Object defaultFieldValue = getFieldFunction.apply(defaultValue);
|
@Nullable Object defaultFieldValue = getFieldFunction.apply(defaultValue);
|
||||||
if (!Util.areEqual(fieldValue, defaultFieldValue)) {
|
if (!Util.areEqual(fieldValue, defaultFieldValue)) {
|
||||||
|
checkNotNull(fieldValue);
|
||||||
dumper.add(field, fieldValue);
|
dumper.add(field, fieldValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,9 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.test.utils;
|
package androidx.media3.test.utils;
|
||||||
|
|
||||||
import static androidx.media3.common.util.Assertions.checkNotNull;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
import androidx.media3.common.util.UnstableApi;
|
import androidx.media3.common.util.UnstableApi;
|
||||||
import androidx.media3.common.util.Util;
|
import androidx.media3.common.util.Util;
|
||||||
@ -49,8 +46,7 @@ public final class Dumper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@CanIgnoreReturnValue
|
@CanIgnoreReturnValue
|
||||||
public Dumper add(String field, @Nullable Object value) {
|
public Dumper add(String field, Object value) {
|
||||||
checkNotNull(value);
|
|
||||||
if (value instanceof byte[]) {
|
if (value instanceof byte[]) {
|
||||||
return add(field, (byte[]) value);
|
return add(field, (byte[]) value);
|
||||||
}
|
}
|
||||||
@ -72,14 +68,10 @@ public final class Dumper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@CanIgnoreReturnValue
|
@CanIgnoreReturnValue
|
||||||
public Dumper add(String field, @Nullable byte[] value) {
|
public Dumper add(String field, byte[] value) {
|
||||||
String string =
|
String string =
|
||||||
String.format(
|
String.format(
|
||||||
Locale.US,
|
Locale.US, "%s = length %d, hash %X", field, value.length, Arrays.hashCode(value));
|
||||||
"%s = length %d, hash %X",
|
|
||||||
field,
|
|
||||||
value == null ? 0 : value.length,
|
|
||||||
Arrays.hashCode(value));
|
|
||||||
return addLine(string);
|
return addLine(string);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package androidx.media3.test.utils.robolectric;
|
package androidx.media3.test.utils.robolectric;
|
||||||
|
|
||||||
|
import static androidx.media3.common.util.Assertions.checkNotNull;
|
||||||
import static java.lang.Math.max;
|
import static java.lang.Math.max;
|
||||||
|
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
@ -426,6 +427,7 @@ public final class PlaybackOutput implements Dumper.Dumpable {
|
|||||||
private static void dumpIfNotEqual(
|
private static void dumpIfNotEqual(
|
||||||
Dumper dumper, String field, @Nullable Object actual, @Nullable Object comparison) {
|
Dumper dumper, String field, @Nullable Object actual, @Nullable Object comparison) {
|
||||||
if (!Util.areEqual(actual, comparison)) {
|
if (!Util.areEqual(actual, comparison)) {
|
||||||
|
checkNotNull(actual);
|
||||||
dumper.add(field, actual);
|
dumper.add(field, actual);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user