Merge "Make LocaleList constructor non-nullable" into nyc-dev
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user