From 401c220c32c6bf6c9d697dba49ff241a8f95e289 Mon Sep 17 00:00:00 2001 From: bachinger Date: Tue, 31 May 2022 09:19:29 +0000 Subject: [PATCH] Add explicit cast to ByteBuffer for Java 8 compatibility PiperOrigin-RevId: 451994696 (cherry picked from commit 1c5032e1a9091e0e53fc881581aaba8d7dfb2dd9) --- .../google/android/exoplayer2/ext/opus/OpusDecoderTest.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/extensions/opus/src/test/java/com/google/android/exoplayer2/ext/opus/OpusDecoderTest.java b/extensions/opus/src/test/java/com/google/android/exoplayer2/ext/opus/OpusDecoderTest.java index dd636be8b3..8a5061f85e 100644 --- a/extensions/opus/src/test/java/com/google/android/exoplayer2/ext/opus/OpusDecoderTest.java +++ b/extensions/opus/src/test/java/com/google/android/exoplayer2/ext/opus/OpusDecoderTest.java @@ -200,8 +200,12 @@ public final class OpusDecoderTest { return ImmutableList.of(HEADER, preSkip, CUSTOM_SEEK_PRE_ROLL_BYTES); } + // The cast to ByteBuffer is required for Java 8 compatibility. See + // https://issues.apache.org/jira/browse/MRESOLVER-85 + @SuppressWarnings("UnnecessaryCast") private static ByteBuffer createSupplementalData(long value) { - return ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN).putLong(value).rewind(); + return (ByteBuffer) + ByteBuffer.allocate(8).order(ByteOrder.LITTLE_ENDIAN).putLong(value).rewind(); } private static DecoderInputBuffer createInputBuffer(