Merge "Make getText() nullable and return null." into sc-dev

This commit is contained in:
Adam He
2021-05-13 20:52:48 +00:00
committed by Android (Google) Code Review
2 changed files with 10 additions and 15 deletions

View File

@@ -52900,7 +52900,7 @@ package android.view.translation {
public final class TranslationRequestValue implements android.os.Parcelable {
method public int describeContents();
method @NonNull public static android.view.translation.TranslationRequestValue forText(@NonNull CharSequence);
method @NonNull public CharSequence getText();
method @Nullable public CharSequence getText();
method public void writeToParcel(@NonNull android.os.Parcel, int);
field @NonNull public static final android.os.Parcelable.Creator<android.view.translation.TranslationRequestValue> CREATOR;
}

View File

@@ -46,22 +46,17 @@ public final class TranslationRequestValue implements Parcelable {
}
/**
* @return the text value as a {@link CharSequence}.
*
* @throws IllegalStateException if the format of this {@link TranslationRequestValue} is not a
* text value.
* @return the text value as a {@link CharSequence} or {@code null} if the value is not of type
* text.
*/
@NonNull
@Nullable
public CharSequence getText() {
if (mText == null) {
throw new IllegalStateException("Value is not of type text");
}
return mText;
}
// Code below generated by codegen v1.0.22.
// Code below generated by codegen v1.0.23.
//
// DO NOT MODIFY!
// CHECKSTYLE:OFF Generated code
@@ -111,7 +106,7 @@ public final class TranslationRequestValue implements Parcelable {
TranslationRequestValue that = (TranslationRequestValue) o;
//noinspection PointlessBooleanExpression
return true
&& java.util.Objects.equals(mText, that.mText);
&& Objects.equals(mText, that.mText);
}
@Override
@@ -121,7 +116,7 @@ public final class TranslationRequestValue implements Parcelable {
// int fieldNameHashCode() { ... }
int _hash = 1;
_hash = 31 * _hash + java.util.Objects.hashCode(mText);
_hash = 31 * _hash + Objects.hashCode(mText);
return _hash;
}
@@ -171,10 +166,10 @@ public final class TranslationRequestValue implements Parcelable {
};
@DataClass.Generated(
time = 1613687761635L,
codegenVersion = "1.0.22",
time = 1620259864154L,
codegenVersion = "1.0.23",
sourceFile = "frameworks/base/core/java/android/view/translation/TranslationRequestValue.java",
inputSignatures = "private final @android.annotation.Nullable java.lang.CharSequence mText\npublic static @android.annotation.NonNull android.view.translation.TranslationRequestValue forText(java.lang.CharSequence)\npublic @android.annotation.NonNull java.lang.CharSequence getText()\nclass TranslationRequestValue extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genHiddenConstructor=true, genToString=true, genEqualsHashCode=true)")
inputSignatures = "private final @android.annotation.Nullable java.lang.CharSequence mText\npublic static @android.annotation.NonNull android.view.translation.TranslationRequestValue forText(java.lang.CharSequence)\npublic @android.annotation.Nullable java.lang.CharSequence getText()\nclass TranslationRequestValue extends java.lang.Object implements [android.os.Parcelable]\n@com.android.internal.util.DataClass(genHiddenConstructor=true, genToString=true, genEqualsHashCode=true)")
@Deprecated
private void __metadata() {}