Merge "Make LocaleList constructor non-nullable" into nyc-dev

This commit is contained in:
Raph Levien
2016-05-03 00:15:22 +00:00
committed by Android (Google) Code Review
3 changed files with 5 additions and 5 deletions

View File

@@ -744,7 +744,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
private void fixUpLocaleList() {
if ((locale == null && !mLocaleList.isEmpty()) ||
(locale != null && !locale.equals(mLocaleList.get(0)))) {
mLocaleList = new LocaleList(locale);
mLocaleList = locale == null ? LocaleList.getEmptyLocaleList() : new LocaleList(locale);
}
}
@@ -1481,7 +1481,7 @@ public final class Configuration implements Parcelable, Comparable<Configuration
* @param loc The locale. Can be null.
*/
public void setLocale(@Nullable Locale loc) {
setLocales(new LocaleList(loc));
setLocales(loc == null ? LocaleList.getEmptyLocaleList() : new LocaleList(loc));
}
/**

View File

@@ -50,7 +50,7 @@ public class LocaleSpan extends MetricAffectingSpan implements ParcelableSpan {
* @see #LocaleSpan(LocaleList)
*/
public LocaleSpan(@Nullable Locale locale) {
mLocales = new LocaleList(locale);
mLocales = locale == null ? LocaleList.getEmptyLocaleList() : new LocaleList(locale);
}
/**

View File

@@ -169,8 +169,8 @@ public final class LocaleList implements Parcelable {
* @throws NullPointerException if any of the input locales is <code>null</code>.
* @throws IllegalArgumentException if any of the input locales repeat.
*/
public LocaleList(@Nullable Locale... list) {
if (list == null || list.length == 0) {
public LocaleList(@NonNull Locale... list) {
if (list.length == 0) {
mList = sEmptyList;
mStringRepresentation = "";
} else {