aboutsummaryrefslogtreecommitdiffstats
path: root/tools/dicttool
diff options
context:
space:
mode:
authorCole Faust <colefaust@google.com>2022-10-15 21:33:30 -0700
committerCole Faust <colefaust@google.com>2022-10-17 11:01:42 -0700
commit91cb9a6acf9cd19ae18094a418b18db33489d2a2 (patch)
tree690db8152834eb200f01c4bd652c5a45d183710a /tools/dicttool
parent370d41de9228127ce0c9a0e055943eaf6d80b7ec (diff)
downloadlatinime-91cb9a6acf9cd19ae18094a418b18db33489d2a2.tar.gz
latinime-91cb9a6acf9cd19ae18094a418b18db33489d2a2.tar.xz
latinime-91cb9a6acf9cd19ae18094a418b18db33489d2a2.zip
Fix errorprone warnings that should be errors
This commit is part of a large scale change to fix errorprone errors that have been downgraded to warnings in the android source tree, so that they can be promoted to errors again. The full list of changes include the following, but not all will be present in any one individual commit: BadAnnotationImplementation BadShiftAmount BanJNDI BoxedPrimitiveEquality ComparableType ComplexBooleanConstant CollectionToArraySafeParameter ConditionalExpressionNumericPromotion DangerousLiteralNull DoubleBraceInitialization DurationFrom DurationTemporalUnit EmptyTopLevelDeclaration EqualsNull EqualsReference FormatString FromTemporalAccessor GetClassOnAnnotation GetClassOnClass HashtableContains IdentityBinaryExpression IdentityHashMapBoxing InstantTemporalUnit InvalidTimeZoneID InvalidZoneId IsInstanceIncompatibleType JUnitParameterMethodNotFound LockOnBoxedPrimitive MathRoundIntLong MislabeledAndroidString MisusedDayOfYear MissingSuperCall MisusedWeekYear ModifyingCollectionWithItself NoCanIgnoreReturnValueOnClasses NonRuntimeAnnotation NullableOnContainingClass NullTernary OverridesJavaxInjectableMethod ParcelableCreator PeriodFrom PreconditionsInvalidPlaceholder ProtoBuilderReturnValueIgnored ProtoFieldNullComparison RandomModInteger RectIntersectReturnValueIgnored ReturnValueIgnored SelfAssignment SelfComparison SelfEquals SizeGreaterThanOrEqualsZero StringBuilderInitWithChar TreeToString TryFailThrowable UnnecessaryCheckNotNull UnusedCollectionModifiedInPlace XorPower See https://errorprone.info/bugpatterns for more information on the checks. Bug: 253827323 Test: m RUN_ERROR_PRONE=true javac-check Change-Id: I454a105ae82484a2d19aff1808e8d9dd55ba64f4
Diffstat (limited to 'tools/dicttool')
-rw-r--r--tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java2
-rw-r--r--tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java2
2 files changed, 2 insertions, 2 deletions
diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
index 84d36a0c3..d3ecc9154 100644
--- a/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
+++ b/tools/dicttool/tests/com/android/inputmethod/latin/dicttool/BinaryDictOffdeviceUtilsTests.java
@@ -162,7 +162,7 @@ public class BinaryDictOffdeviceUtilsTests extends TestCase {
options.put("locale", "en_US");
options.put("version", Integer.toString(mRandom.nextInt()));
// Add some random options for test
- final int numberOfOptionsToAdd = mRandom.nextInt() % (MAX_NUMBER_OF_OPTIONS_TO_ADD + 1);
+ final int numberOfOptionsToAdd = mRandom.nextInt(MAX_NUMBER_OF_OPTIONS_TO_ADD + 1);
for (int i = 0; i < numberOfOptionsToAdd; ++i) {
options.put(sWords.get(2 * i), sWords.get(2 * 1 + 1));
}
diff --git a/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java b/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java
index 626023920..901d0cef3 100644
--- a/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java
+++ b/tools/dicttool/tests/com/android/inputmethod/latin/makedict/FusionDictionaryTest.java
@@ -47,7 +47,7 @@ public class FusionDictionaryTest extends TestCase {
*/
private String generateWord(final Random random) {
StringBuilder builder = new StringBuilder("a");
- int count = random.nextInt() % 30;
+ int count = random.nextInt(30);
while (count > 0) {
final long r = Math.abs(random.nextInt());
if (r < 0) continue;