aboutsummaryrefslogtreecommitdiffstats
path: root/tools/dicttool/compat/android
diff options
context:
space:
mode:
Diffstat (limited to 'tools/dicttool/compat/android')
-rw-r--r--tools/dicttool/compat/android/test/MoreAsserts.java35
-rw-r--r--tools/dicttool/compat/android/text/TextUtils.java16
-rw-r--r--tools/dicttool/compat/android/util/Pair.java1
-rw-r--r--tools/dicttool/compat/android/view/inputmethod/CompletionInfo.java1
4 files changed, 7 insertions, 46 deletions
diff --git a/tools/dicttool/compat/android/test/MoreAsserts.java b/tools/dicttool/compat/android/test/MoreAsserts.java
deleted file mode 100644
index f56420b9c..000000000
--- a/tools/dicttool/compat/android/test/MoreAsserts.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2013 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.test;
-
-import junit.framework.Assert;
-
-/**
- * This is a compatibility class that aims at emulating android.test.MoreAsserts from the
- * Android library as simply as possible, and only to the extent that is used by the client classes.
- * Its purpose is to provide compatibility without having to pull the whole Android library.
- */
-public class MoreAsserts {
- public static void assertNotEqual(Object unexpected, Object actual) {
- if (equal(unexpected, actual)) {
- Assert.fail("expected not to be:<" + unexpected + ">");
- }
- }
- private static boolean equal(Object a, Object b) {
- return a == b || (a != null && a.equals(b));
- }
-}
diff --git a/tools/dicttool/compat/android/text/TextUtils.java b/tools/dicttool/compat/android/text/TextUtils.java
index 5a94b7d4c..82483319e 100644
--- a/tools/dicttool/compat/android/text/TextUtils.java
+++ b/tools/dicttool/compat/android/text/TextUtils.java
@@ -25,10 +25,7 @@ public class TextUtils {
* @return true if str is null or zero length
*/
public static boolean isEmpty(CharSequence str) {
- if (str == null || str.length() == 0)
- return true;
- else
- return false;
+ return (str == null || str.length() == 0);
}
/**
@@ -45,12 +42,11 @@ public class TextUtils {
if (a != null && b != null && (length = a.length()) == b.length()) {
if (a instanceof String && b instanceof String) {
return a.equals(b);
- } else {
- for (int i = 0; i < length; i++) {
- if (a.charAt(i) != b.charAt(i)) return false;
- }
- return true;
}
+ for (int i = 0; i < length; i++) {
+ if (a.charAt(i) != b.charAt(i)) return false;
+ }
+ return true;
}
return false;
}
@@ -90,7 +86,7 @@ public class TextUtils {
* @param tokens an array objects to be joined. Strings will be formed from
* the objects by calling object.toString().
*/
- public static String join(CharSequence delimiter, Iterable tokens) {
+ public static String join(CharSequence delimiter, Iterable<?> tokens) {
StringBuilder sb = new StringBuilder();
boolean firstTime = true;
for (Object token: tokens) {
diff --git a/tools/dicttool/compat/android/util/Pair.java b/tools/dicttool/compat/android/util/Pair.java
index ab6096ee3..e61e896b7 100644
--- a/tools/dicttool/compat/android/util/Pair.java
+++ b/tools/dicttool/compat/android/util/Pair.java
@@ -16,7 +16,6 @@
package android.util;
-import java.util.Arrays;
import java.util.Objects;
public class Pair<T1, T2> {
diff --git a/tools/dicttool/compat/android/view/inputmethod/CompletionInfo.java b/tools/dicttool/compat/android/view/inputmethod/CompletionInfo.java
index fbce72556..e2f769ec8 100644
--- a/tools/dicttool/compat/android/view/inputmethod/CompletionInfo.java
+++ b/tools/dicttool/compat/android/view/inputmethod/CompletionInfo.java
@@ -16,6 +16,7 @@
package android.view.inputmethod;
+@SuppressWarnings("static-method")
public class CompletionInfo {
public final String getText() { return ""; }
}