Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4cfee8eb authored by William Escande's avatar William Escande
Browse files

Follow error prone recommendation

```
In SignedLongLong.java
47: warning: This assignment to the local variable 'lsb' is never read.
        long lsb = 0, msb = 0;
             ^
100: warning: Classes that override equals should also override hashCode
    public boolean equals(Object obj) {
                   ^
43: warning: A block tag has an empty description.
     * @throws UnsupportedEncodingException
       ^
100: warning: Prefer instanceof to getClass when implementing equals.
    public boolean equals(Object obj) {
                   ^
```

Bug: 236759221
Test: m RUN_ERROR_PRONE=true Bluetooth
Change-Id: Ie931ff50b3f7c7b4a5b5274d0244d2d57cad4319
parent 427d6f2f
Loading
Loading
Loading
Loading
+12 −4
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.bluetooth;
import com.android.bluetooth.map.BluetoothMapUtils;

import java.io.UnsupportedEncodingException;
import java.util.Objects;

/**
 * Class to represent a 128bit value using two long member variables.
@@ -40,11 +41,13 @@ public class SignedLongLong implements Comparable<SignedLongLong> {
     * Create a SignedLongLong from a Hex-String without "0x" prefix
     * @param value the hex-string
     * @return the created object
     * @throws UnsupportedEncodingException
     * @throws UnsupportedEncodingException if "US-ASCII" charset is not supported,
     * @throws NullPointerException if the string {@code value} is null,
     * @throws NumberFormatException if the string {@code value} contains invalid characters.
     */
    public static SignedLongLong fromString(String value) throws UnsupportedEncodingException {
        String lsbStr, msbStr;
        long lsb = 0, msb = 0;
        long msb = 0;

        lsbStr = msbStr = null;
        if (value == null) {
@@ -62,7 +65,7 @@ public class SignedLongLong implements Comparable<SignedLongLong> {
            msbStr = value.substring(0, valueLength - 16);
            msb = BluetoothMapUtils.getLongFromString(msbStr);
        }
        lsb = BluetoothMapUtils.getLongFromString(lsbStr);
        long lsb = BluetoothMapUtils.getLongFromString(lsbStr);
        return new SignedLongLong(lsb, msb);
    }

@@ -104,7 +107,7 @@ public class SignedLongLong implements Comparable<SignedLongLong> {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
        if (!(obj instanceof SignedLongLong)) {
            return false;
        }
        SignedLongLong other = (SignedLongLong) obj;
@@ -117,6 +120,11 @@ public class SignedLongLong implements Comparable<SignedLongLong> {
        return true;
    }

    @Override
    public int hashCode() {
        return Objects.hash(mLeastSigBits, mMostSigBits);
    }

    public long getMostSignificantBits() {
        return mMostSigBits;
    }