Fix array-related errorprone warnings

The ArrayEquals, ArrayHashCode, ArrayToString, and
ArraysAsListPrimitiveArray errorprone findings were
demoted from errors to warnings. Fix existing
occurrences of them so they can be made errors again.

Bug: 242630963
Test: RUN_ERROR_PRONE=true m javac-check
Change-Id: I95b4d0f8d3dfa957285ca94e0846fd3da4734e57
This commit is contained in:
Cole Faust
2022-08-15 15:03:08 -07:00
committed by Lorenzo Colitti
parent 6956ac5eb5
commit fe60c0fe31
3 changed files with 9 additions and 6 deletions

View File

@@ -1273,8 +1273,10 @@ public class TetheringManager {
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash(mTetherableBluetoothRegexs, mTetherableUsbRegexs, return Objects.hash(
mTetherableWifiRegexs); Arrays.hashCode(mTetherableBluetoothRegexs),
Arrays.hashCode(mTetherableUsbRegexs),
Arrays.hashCode(mTetherableWifiRegexs));
} }
@Override @Override

View File

@@ -143,7 +143,7 @@ public class MdnsServiceRecord extends MdnsRecord {
return super.equals(other) return super.equals(other)
&& (servicePriority == otherRecord.servicePriority) && (servicePriority == otherRecord.servicePriority)
&& (serviceWeight == otherRecord.serviceWeight) && (serviceWeight == otherRecord.serviceWeight)
&& Objects.equals(serviceHost, otherRecord.serviceHost) && Arrays.equals(serviceHost, otherRecord.serviceHost)
&& (servicePort == otherRecord.servicePort); && (servicePort == otherRecord.servicePort);
} }
} }

View File

@@ -27,12 +27,13 @@ import static org.junit.Assert.fail;
import android.os.ParcelFileDescriptor; import android.os.ParcelFileDescriptor;
import com.android.net.module.util.CollectionUtils;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.function.Predicate; import java.util.function.Predicate;
@@ -170,7 +171,7 @@ public class TunUtils {
*/ */
private static boolean isEspFailIfSpecifiedPlaintextFound( private static boolean isEspFailIfSpecifiedPlaintextFound(
byte[] pkt, int spi, boolean encap, byte[] plaintext) { byte[] pkt, int spi, boolean encap, byte[] plaintext) {
if (Collections.indexOfSubList(Arrays.asList(pkt), Arrays.asList(plaintext)) != -1) { if (CollectionUtils.indexOfSubArray(pkt, plaintext) != -1) {
fail("Banned plaintext packet found"); fail("Banned plaintext packet found");
} }