diff options
author | 2014-11-17 18:07:35 +0900 | |
---|---|---|
committer | 2014-11-21 12:02:06 +0900 | |
commit | ebe5b42f71bd63973edffbda691b498611326c6f (patch) | |
tree | 3678307310e30775937e01d6cb2add65c1f7d52f /common/src/com/android/inputmethod/latin | |
parent | a94733cbca5bc3544fa73fa1649bbb1dadf31356 (diff) | |
download | latinime-ebe5b42f71bd63973edffbda691b498611326c6f.tar.gz latinime-ebe5b42f71bd63973edffbda691b498611326c6f.tar.xz latinime-ebe5b42f71bd63973edffbda691b498611326c6f.zip |
Make LocaleUtils.constructLocaleFromString as @Nonnull
Change-Id: I82d574c67b25239510f3ecc8882efe46e40677eb
Diffstat (limited to 'common/src/com/android/inputmethod/latin')
-rw-r--r-- | common/src/com/android/inputmethod/latin/common/LocaleUtils.java | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/common/src/com/android/inputmethod/latin/common/LocaleUtils.java b/common/src/com/android/inputmethod/latin/common/LocaleUtils.java index 7f2333be5..d5878c024 100644 --- a/common/src/com/android/inputmethod/latin/common/LocaleUtils.java +++ b/common/src/com/android/inputmethod/latin/common/LocaleUtils.java @@ -104,7 +104,8 @@ public final class LocaleUtils { * @param testedLocale the locale to test. * @return a constant that measures how well the tested locale matches the reference locale. */ - public static int getMatchLevel(final String referenceLocale, final String testedLocale) { + public static int getMatchLevel(@Nullable final String referenceLocale, + @Nullable final String testedLocale) { if (StringUtils.isEmpty(referenceLocale)) { return StringUtils.isEmpty(testedLocale) ? LOCALE_FULL_MATCH : LOCALE_ANY_MATCH; } @@ -167,11 +168,8 @@ public final class LocaleUtils { * @param localeString a string specification of a locale, in a format of "ll_cc_variant" where * "ll" is a language code, "cc" is a country code. */ - @Nullable - public static Locale constructLocaleFromString(@Nullable final String localeString) { - if (localeString == null) { - return null; - } + @Nonnull + public static Locale constructLocaleFromString(@Nonnull final String localeString) { synchronized (sLocaleCache) { if (sLocaleCache.containsKey(localeString)) { return sLocaleCache.get(localeString); |