From ebe5b42f71bd63973edffbda691b498611326c6f Mon Sep 17 00:00:00 2001 From: "Tadashi G. Takaoka" Date: Mon, 17 Nov 2014 18:07:35 +0900 Subject: Make LocaleUtils.constructLocaleFromString as @Nonnull Change-Id: I82d574c67b25239510f3ecc8882efe46e40677eb --- .../src/com/android/inputmethod/latin/common/LocaleUtils.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'common/src/com/android/inputmethod') 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); -- cgit v1.2.3-83-g751a