aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTadashi G. Takaoka <takaoka@google.com>2014-10-27 09:43:22 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-10-27 09:43:22 +0000
commitd5455fea4ad710e4b31890affe8efab948fe586e (patch)
tree7fd02dadc7fd5ec6e36fb39336f636f2024ffad4
parentf6a637109636f39fbcf932bab1709ff247690da8 (diff)
parent7a3de4dca9e03a59bad21e50c3a751e839baab14 (diff)
downloadlatinime-d5455fea4ad710e4b31890affe8efab948fe586e.tar.gz
latinime-d5455fea4ad710e4b31890affe8efab948fe586e.tar.xz
latinime-d5455fea4ad710e4b31890affe8efab948fe586e.zip
Merge "Add null analysis annotation to CollectionUtils"
-rw-r--r--java/src/com/android/inputmethod/latin/utils/CollectionUtils.java12
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java1
2 files changed, 7 insertions, 6 deletions
diff --git a/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java b/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java
index d0df72479..f9839eb91 100644
--- a/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/CollectionUtils.java
@@ -19,15 +19,17 @@ package com.android.inputmethod.latin.utils;
import java.util.ArrayList;
import java.util.Collection;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
public final class CollectionUtils {
private CollectionUtils() {
// This utility class is not publicly instantiable.
}
- public static <E> ArrayList<E> arrayAsList(final E[] array, final int start, final int end) {
- if (array == null) {
- throw new NullPointerException();
- }
+ @Nonnull
+ public static <E> ArrayList<E> arrayAsList(@Nonnull final E[] array, final int start,
+ final int end) {
if (start < 0 || start > end || end > array.length) {
throw new IllegalArgumentException();
}
@@ -44,7 +46,7 @@ public final class CollectionUtils {
* @param c Collection to test.
* @return Whether c contains no elements.
*/
- public static boolean isNullOrEmpty(final Collection<?> c) {
+ public static boolean isNullOrEmpty(@Nullable final Collection<?> c) {
return c == null || c.isEmpty();
}
}
diff --git a/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
index 3feb60ec7..a5979c3df 100644
--- a/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
@@ -51,5 +51,4 @@ public class CollectionUtilsTests extends AndroidTestCase {
assertTrue(CollectionUtils.isNullOrEmpty(Collections.EMPTY_SET));
assertFalse(CollectionUtils.isNullOrEmpty(Collections.singleton("Not empty")));
}
-
}