From 564c3bcb49e32b0d69c49c62741b036818895719 Mon Sep 17 00:00:00 2001 From: ibaker Date: Thu, 3 Feb 2022 12:09:38 +0000 Subject: [PATCH] Mark some unreleased IntDefs as TYPE_USE only The longer list of targets is only necessary for backwards compatibility with existing Kotlin code that will stop compiling if the position of the annotation becomes 'wrong' by marking it only TYPE_USE. Since none of these IntDefs have been released (except in media3 alpha1) we don't need to maintain this compatibility. Also add a comment to all the places that *do* need the longer list of targets, in order to explain why it's there and discourage copy-pasting when defining new IntDefs in future. Also fix some single-element arrays to remove the array notation. #minor-release PiperOrigin-RevId: 426108537 --- .../java/com/google/android/exoplayer2/C.java | 16 +++++++++++++++- .../google/android/exoplayer2/DeviceInfo.java | 5 +++-- .../android/exoplayer2/MediaMetadata.java | 4 ++++ .../android/exoplayer2/PlaybackException.java | 2 ++ .../com/google/android/exoplayer2/Player.java | 18 ++++++++++++++++++ .../google/android/exoplayer2/text/Cue.java | 8 ++++++++ .../trackselection/TrackSelection.java | 5 +++-- .../android/exoplayer2/ui/AdOverlayInfo.java | 2 ++ .../exoplayer2/analytics/PlaybackStats.java | 4 ++-- .../exoplayer2/audio/SpatializerDelegate.java | 6 +----- .../exoplayer2/extractor/wav/WavExtractor.java | 4 ++-- .../exoplayer2/source/hls/HlsMediaSource.java | 4 ++-- .../transformer/TransformationException.java | 6 +----- 13 files changed, 63 insertions(+), 21 deletions(-) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/C.java b/library/common/src/main/java/com/google/android/exoplayer2/C.java index 24a0fc2d13..0d71ac6cec 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/C.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/C.java @@ -275,7 +275,7 @@ public final class C { /** Represents the behavior affecting whether spatialization will be used. */ @Documented @Retention(RetentionPolicy.SOURCE) - @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) + @Target(TYPE_USE) @IntDef({SPATIALIZATION_BEHAVIOR_AUTO, SPATIALIZATION_BEHAVIOR_NEVER}) public @interface SpatializationBehavior {} @@ -328,6 +328,8 @@ public final class C { * #CONTENT_TYPE_MUSIC}, {@link #CONTENT_TYPE_SONIFICATION}, {@link #CONTENT_TYPE_SPEECH} or * {@link #CONTENT_TYPE_UNKNOWN}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -357,6 +359,8 @@ public final class C { *

Note that {@code FLAG_HW_AV_SYNC} is not available because the player takes care of setting * the flag when tunneling is enabled via a track selector. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -378,6 +382,8 @@ public final class C { * #USAGE_NOTIFICATION_RINGTONE}, {@link #USAGE_UNKNOWN}, {@link #USAGE_VOICE_COMMUNICATION} or * {@link #USAGE_VOICE_COMMUNICATION_SIGNALLING}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -447,6 +453,8 @@ public final class C { * Capture policies for audio attributes. One of {@link #ALLOW_CAPTURE_BY_ALL}, {@link * #ALLOW_CAPTURE_BY_NONE} or {@link #ALLOW_CAPTURE_BY_SYSTEM}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -597,6 +605,8 @@ public final class C { * Track selection flags. Possible flag values are {@link #SELECTION_FLAG_DEFAULT}, {@link * #SELECTION_FLAG_FORCED} and {@link #SELECTION_FLAG_AUTOSELECT}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -1010,6 +1020,8 @@ public final class C { * Mode specifying whether the player should hold a WakeLock and a WifiLock. One of {@link * #WAKE_MODE_NONE}, {@link #WAKE_MODE_LOCAL} or {@link #WAKE_MODE_NETWORK}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -1047,6 +1059,8 @@ public final class C { * {@link #ROLE_FLAG_TRANSCRIBES_DIALOG}, {@link #ROLE_FLAG_EASY_TO_READ} and {@link * #ROLE_FLAG_TRICK_PLAY}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/DeviceInfo.java b/library/common/src/main/java/com/google/android/exoplayer2/DeviceInfo.java index 9ae078ae32..1288e19aa9 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/DeviceInfo.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/DeviceInfo.java @@ -15,11 +15,12 @@ */ package com.google.android.exoplayer2; +import static java.lang.annotation.ElementType.TYPE_USE; + import android.os.Bundle; import androidx.annotation.IntDef; import androidx.annotation.Nullable; import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -30,7 +31,7 @@ public final class DeviceInfo implements Bundleable { /** Types of playback. One of {@link #PLAYBACK_TYPE_LOCAL} or {@link #PLAYBACK_TYPE_REMOTE}. */ @Documented @Retention(RetentionPolicy.SOURCE) - @Target({ElementType.TYPE_USE}) + @Target(TYPE_USE) @IntDef({ PLAYBACK_TYPE_LOCAL, PLAYBACK_TYPE_REMOTE, diff --git a/library/common/src/main/java/com/google/android/exoplayer2/MediaMetadata.java b/library/common/src/main/java/com/google/android/exoplayer2/MediaMetadata.java index 70c5b89783..e60647ad31 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/MediaMetadata.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/MediaMetadata.java @@ -516,6 +516,8 @@ public final class MediaMetadata implements Bundleable { * href="https://www.bluetooth.com/specifications/specs/a-v-remote-control-profile-1-6-2/">Bluetooth * AVRCP 1.6.2). */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -554,6 +556,8 @@ public final class MediaMetadata implements Bundleable { *

Values sourced from the ID3 v2.4 specification (See section 4.14 of * https://id3.org/id3v2.4.0-frames). */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/PlaybackException.java b/library/common/src/main/java/com/google/android/exoplayer2/PlaybackException.java index febb938fdb..0a3b012d8f 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/PlaybackException.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/PlaybackException.java @@ -45,6 +45,8 @@ public class PlaybackException extends Exception implements Bundleable { *

This list of errors may be extended in future versions, and {@link Player} implementations * may define custom error codes. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/Player.java b/library/common/src/main/java/com/google/android/exoplayer2/Player.java index 28aa61057d..106882076c 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/Player.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/Player.java @@ -1082,6 +1082,8 @@ public interface Player { * Playback state. One of {@link #STATE_IDLE}, {@link #STATE_BUFFERING}, {@link #STATE_READY} or * {@link #STATE_ENDED}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -1114,6 +1116,8 @@ public interface Player { * #PLAY_WHEN_READY_CHANGE_REASON_REMOTE} or {@link * #PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -1141,6 +1145,8 @@ public interface Player { * of {@link #PLAYBACK_SUPPRESSION_REASON_NONE} or {@link * #PLAYBACK_SUPPRESSION_REASON_TRANSIENT_AUDIO_FOCUS_LOSS}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -1158,6 +1164,8 @@ public interface Player { * Repeat modes for playback. One of {@link #REPEAT_MODE_OFF}, {@link #REPEAT_MODE_ONE} or {@link * #REPEAT_MODE_ALL}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -1190,6 +1198,8 @@ public interface Player { * #DISCONTINUITY_REASON_SKIP}, {@link #DISCONTINUITY_REASON_REMOVE} or {@link * #DISCONTINUITY_REASON_INTERNAL}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -1229,6 +1239,8 @@ public interface Player { * Reasons for timeline changes. One of {@link #TIMELINE_CHANGE_REASON_PLAYLIST_CHANGED} or {@link * #TIMELINE_CHANGE_REASON_SOURCE_UPDATE}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -1250,6 +1262,8 @@ public interface Player { * #MEDIA_ITEM_TRANSITION_REASON_AUTO}, {@link #MEDIA_ITEM_TRANSITION_REASON_SEEK} or {@link * #MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -1283,6 +1297,8 @@ public interface Player { * *

One of the {@link Player}{@code .EVENT_*} values. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -1369,6 +1385,8 @@ public interface Player { * #COMMAND_SET_VIDEO_SURFACE}, {@link #COMMAND_GET_TEXT}, {@link * #COMMAND_SET_TRACK_SELECTION_PARAMETERS} or {@link #COMMAND_GET_TRACK_INFOS}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/text/Cue.java b/library/common/src/main/java/com/google/android/exoplayer2/text/Cue.java index 436bea7048..47cc0018ee 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/text/Cue.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/text/Cue.java @@ -58,6 +58,8 @@ public final class Cue implements Bundleable { * The type of anchor, which may be unset. One of {@link #TYPE_UNSET}, {@link #ANCHOR_TYPE_START}, * {@link #ANCHOR_TYPE_MIDDLE} or {@link #ANCHOR_TYPE_END}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -86,6 +88,8 @@ public final class Cue implements Bundleable { * The type of line, which may be unset. One of {@link #TYPE_UNSET}, {@link #LINE_TYPE_FRACTION} * or {@link #LINE_TYPE_NUMBER}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -103,6 +107,8 @@ public final class Cue implements Bundleable { * {@link #TEXT_SIZE_TYPE_FRACTIONAL}, {@link #TEXT_SIZE_TYPE_FRACTIONAL_IGNORE_PADDING} or {@link * #TEXT_SIZE_TYPE_ABSOLUTE}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) @@ -127,6 +133,8 @@ public final class Cue implements Bundleable { * The type of vertical layout for this cue, which may be unset (i.e. horizontal). One of {@link * #TYPE_UNSET}, {@link #VERTICAL_TYPE_RL} or {@link #VERTICAL_TYPE_LR}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelection.java b/library/common/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelection.java index 6ba2687326..493d41c90c 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelection.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelection.java @@ -15,12 +15,13 @@ */ package com.google.android.exoplayer2.trackselection; +import static java.lang.annotation.ElementType.TYPE_USE; + import androidx.annotation.IntDef; import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.source.TrackGroup; import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -39,7 +40,7 @@ public interface TrackSelection { */ @Documented @Retention(RetentionPolicy.SOURCE) - @Target({ElementType.TYPE_USE}) + @Target(TYPE_USE) @IntDef( open = true, value = {TYPE_UNSET}) diff --git a/library/common/src/main/java/com/google/android/exoplayer2/ui/AdOverlayInfo.java b/library/common/src/main/java/com/google/android/exoplayer2/ui/AdOverlayInfo.java index ef58b8190d..ec25824df0 100644 --- a/library/common/src/main/java/com/google/android/exoplayer2/ui/AdOverlayInfo.java +++ b/library/common/src/main/java/com/google/android/exoplayer2/ui/AdOverlayInfo.java @@ -36,6 +36,8 @@ public final class AdOverlayInfo { * The purpose of the overlay. One of {@link #PURPOSE_CONTROLS}, {@link #PURPOSE_CLOSE_AD}, {@link * #PURPOSE_OTHER} or {@link #PURPOSE_NOT_VISIBLE}. */ + // @Target list includes both 'default' targets and TYPE_USE, to ensure backwards compatibility + // with Kotlin usages from before TYPE_USE was added. @Documented @Retention(RetentionPolicy.SOURCE) @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/analytics/PlaybackStats.java b/library/core/src/main/java/com/google/android/exoplayer2/analytics/PlaybackStats.java index 0c23877c27..029d1ea0db 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/analytics/PlaybackStats.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/analytics/PlaybackStats.java @@ -17,6 +17,7 @@ package com.google.android.exoplayer2.analytics; import static java.lang.Math.max; import static java.lang.Math.min; +import static java.lang.annotation.ElementType.TYPE_USE; import android.os.SystemClock; import androidx.annotation.IntDef; @@ -25,7 +26,6 @@ import com.google.android.exoplayer2.C; import com.google.android.exoplayer2.Format; import com.google.android.exoplayer2.analytics.AnalyticsListener.EventTime; import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -172,7 +172,7 @@ public final class PlaybackStats { */ @Documented @Retention(RetentionPolicy.SOURCE) - @Target({ElementType.TYPE_USE}) + @Target(TYPE_USE) @IntDef({ PLAYBACK_STATE_NOT_STARTED, PLAYBACK_STATE_JOINING_BACKGROUND, diff --git a/library/core/src/main/java/com/google/android/exoplayer2/audio/SpatializerDelegate.java b/library/core/src/main/java/com/google/android/exoplayer2/audio/SpatializerDelegate.java index 9af179132d..6b5adab946 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/audio/SpatializerDelegate.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/audio/SpatializerDelegate.java @@ -16,10 +16,6 @@ package com.google.android.exoplayer2.audio; import static com.google.android.exoplayer2.util.Assertions.checkStateNotNull; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.LOCAL_VARIABLE; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE_USE; import android.content.Context; @@ -52,7 +48,7 @@ import java.util.concurrent.Executor; /** Level of support for audio spatialization. */ @Documented @Retention(RetentionPolicy.SOURCE) - @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) + @Target(TYPE_USE) @IntDef({ SPATIALIZER_IMMERSIVE_LEVEL_MULTICHANNEL, SPATIALIZER_IMMERSIVE_LEVEL_NONE, diff --git a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/wav/WavExtractor.java b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/wav/WavExtractor.java index 141512096b..7d9ba15495 100644 --- a/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/wav/WavExtractor.java +++ b/library/extractor/src/main/java/com/google/android/exoplayer2/extractor/wav/WavExtractor.java @@ -17,6 +17,7 @@ package com.google.android.exoplayer2.extractor.wav; import static java.lang.Math.max; import static java.lang.Math.min; +import static java.lang.annotation.ElementType.TYPE_USE; import android.util.Pair; import androidx.annotation.IntDef; @@ -37,7 +38,6 @@ import com.google.android.exoplayer2.util.ParsableByteArray; import com.google.android.exoplayer2.util.Util; import java.io.IOException; import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; @@ -63,7 +63,7 @@ public final class WavExtractor implements Extractor { /** Parser state. */ @Documented @Retention(RetentionPolicy.SOURCE) - @Target({ElementType.TYPE_USE}) + @Target(TYPE_USE) @IntDef({ STATE_READING_FILE_TYPE, STATE_READING_RF64_SAMPLE_DATA_SIZE, diff --git a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java index e7143ffd27..083ed76465 100644 --- a/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java +++ b/library/hls/src/main/java/com/google/android/exoplayer2/source/hls/HlsMediaSource.java @@ -16,6 +16,7 @@ package com.google.android.exoplayer2.source.hls; import static com.google.android.exoplayer2.util.Assertions.checkNotNull; +import static java.lang.annotation.ElementType.TYPE_USE; import static java.lang.annotation.RetentionPolicy.SOURCE; import android.os.Looper; @@ -56,7 +57,6 @@ import com.google.android.exoplayer2.upstream.TransferListener; import com.google.android.exoplayer2.util.Util; import java.io.IOException; import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.Target; import java.util.List; @@ -83,7 +83,7 @@ public final class HlsMediaSource extends BaseMediaSource */ @Documented @Retention(SOURCE) - @Target({ElementType.TYPE_USE}) + @Target(TYPE_USE) @IntDef({METADATA_TYPE_ID3, METADATA_TYPE_EMSG}) public @interface MetadataType {} diff --git a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformationException.java b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformationException.java index 0c4fcef310..e4992e1ee9 100644 --- a/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformationException.java +++ b/library/transformer/src/main/java/com/google/android/exoplayer2/transformer/TransformationException.java @@ -15,10 +15,6 @@ */ package com.google.android.exoplayer2.transformer; -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.LOCAL_VARIABLE; -import static java.lang.annotation.ElementType.METHOD; -import static java.lang.annotation.ElementType.PARAMETER; import static java.lang.annotation.ElementType.TYPE_USE; import android.media.MediaCodec; @@ -49,7 +45,7 @@ public final class TransformationException extends Exception { // TODO(b/209469847): Update the javadoc once the underlying values are fixed. @Documented @Retention(RetentionPolicy.SOURCE) - @Target({FIELD, METHOD, PARAMETER, LOCAL_VARIABLE, TYPE_USE}) + @Target(TYPE_USE) @IntDef( open = true, value = {