Annotate Cue.Builder getters with @Pure

This reduces the null-checking required in a follow-up change.

PiperOrigin-RevId: 375468504
This commit is contained in:
ibaker 2021-05-24 15:02:05 +01:00 committed by Oliver Woodman
parent 5afc915e51
commit 2081f4b466

View File

@ -30,6 +30,7 @@ import com.google.common.base.Objects;
import java.lang.annotation.Documented; import java.lang.annotation.Documented;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy; import java.lang.annotation.RetentionPolicy;
import org.checkerframework.dataflow.qual.Pure;
/** Contains information about a specific cue, including textual content and formatting data. */ /** Contains information about a specific cue, including textual content and formatting data. */
// This class shouldn't be sub-classed. If a subtitle format needs additional fields, either they // This class shouldn't be sub-classed. If a subtitle format needs additional fields, either they
@ -604,6 +605,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#text * @see Cue#text
*/ */
@Pure
@Nullable @Nullable
public CharSequence getText() { public CharSequence getText() {
return text; return text;
@ -624,6 +626,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#bitmap * @see Cue#bitmap
*/ */
@Pure
@Nullable @Nullable
public Bitmap getBitmap() { public Bitmap getBitmap() {
return bitmap; return bitmap;
@ -646,6 +649,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#textAlignment * @see Cue#textAlignment
*/ */
@Pure
@Nullable @Nullable
public Alignment getTextAlignment() { public Alignment getTextAlignment() {
return textAlignment; return textAlignment;
@ -682,6 +686,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#line * @see Cue#line
*/ */
@Pure
public float getLine() { public float getLine() {
return line; return line;
} }
@ -691,6 +696,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#lineType * @see Cue#lineType
*/ */
@Pure
@LineType @LineType
public int getLineType() { public int getLineType() {
return lineType; return lineType;
@ -711,6 +717,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#lineAnchor * @see Cue#lineAnchor
*/ */
@Pure
@AnchorType @AnchorType
public int getLineAnchor() { public int getLineAnchor() {
return lineAnchor; return lineAnchor;
@ -733,6 +740,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#position * @see Cue#position
*/ */
@Pure
public float getPosition() { public float getPosition() {
return position; return position;
} }
@ -752,6 +760,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#positionAnchor * @see Cue#positionAnchor
*/ */
@Pure
@AnchorType @AnchorType
public int getPositionAnchor() { public int getPositionAnchor() {
return positionAnchor; return positionAnchor;
@ -774,6 +783,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#textSizeType * @see Cue#textSizeType
*/ */
@Pure
@TextSizeType @TextSizeType
public int getTextSizeType() { public int getTextSizeType() {
return textSizeType; return textSizeType;
@ -784,6 +794,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#textSize * @see Cue#textSize
*/ */
@Pure
public float getTextSize() { public float getTextSize() {
return textSize; return textSize;
} }
@ -805,6 +816,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#size * @see Cue#size
*/ */
@Pure
public float getSize() { public float getSize() {
return size; return size;
} }
@ -824,6 +836,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#bitmapHeight * @see Cue#bitmapHeight
*/ */
@Pure
public float getBitmapHeight() { public float getBitmapHeight() {
return bitmapHeight; return bitmapHeight;
} }
@ -862,6 +875,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#windowColor * @see Cue#windowColor
*/ */
@Pure
@ColorInt @ColorInt
public int getWindowColor() { public int getWindowColor() {
return windowColor; return windowColor;
@ -888,6 +902,7 @@ public final class Cue implements Bundleable {
* *
* @see Cue#verticalType * @see Cue#verticalType
*/ */
@Pure
@VerticalType @VerticalType
public int getVerticalType() { public int getVerticalType() {
return verticalType; return verticalType;