1
0
mirror of https://github.com/mik3y/usb-serial-for-android.git synced 2026-08-14 01:43:08 +00:00

fixed some warnings

This commit is contained in:
kai-morich
2021-04-02 19:40:54 +02:00
parent b6e9dbe40f
commit f1d73c04dc
15 changed files with 46 additions and 46 deletions
@@ -287,7 +287,7 @@ public class CdcAcmSerialDriver implements UsbSerialDriver {
}
public static Map<Integer, int[]> getSupportedDevices() {
final Map<Integer, int[]> supportedDevices = new LinkedHashMap<Integer, int[]>();
final Map<Integer, int[]> supportedDevices = new LinkedHashMap<>();
supportedDevices.put(UsbId.VENDOR_ARDUINO,
new int[] {
UsbId.ARDUINO_UNO,
@@ -363,7 +363,7 @@ public class Ch34xSerialDriver implements UsbSerialDriver {
}
public static Map<Integer, int[]> getSupportedDevices() {
final Map<Integer, int[]> supportedDevices = new LinkedHashMap<Integer, int[]>();
final Map<Integer, int[]> supportedDevices = new LinkedHashMap<>();
supportedDevices.put(UsbId.VENDOR_QINHENG, new int[]{
UsbId.QINHENG_CH340,
UsbId.QINHENG_CH341A,
@@ -322,7 +322,7 @@ public class Cp21xxSerialDriver implements UsbSerialDriver {
}
public static Map<Integer, int[]> getSupportedDevices() {
final Map<Integer, int[]> supportedDevices = new LinkedHashMap<Integer, int[]>();
final Map<Integer, int[]> supportedDevices = new LinkedHashMap<>();
supportedDevices.put(UsbId.VENDOR_SILABS,
new int[] {
UsbId.SILABS_CP2102, // same ID for CP2101, CP2103, CP2104, CP2109
@@ -415,7 +415,7 @@ public class FtdiSerialDriver implements UsbSerialDriver {
}
public static Map<Integer, int[]> getSupportedDevices() {
final Map<Integer, int[]> supportedDevices = new LinkedHashMap<Integer, int[]>();
final Map<Integer, int[]> supportedDevices = new LinkedHashMap<>();
supportedDevices.put(UsbId.VENDOR_FTDI,
new int[] {
UsbId.FTDI_FT232R,
@@ -21,7 +21,7 @@ import java.util.Map;
public class ProbeTable {
private final Map<Pair<Integer, Integer>, Class<? extends UsbSerialDriver>> mProbeTable =
new LinkedHashMap<Pair<Integer,Integer>, Class<? extends UsbSerialDriver>>();
new LinkedHashMap<>();
/**
* Adds or updates a (vendor, product) pair in the table.
@@ -35,7 +35,7 @@ public class ProlificSerialDriver implements UsbSerialDriver {
28800, 38400, 57600, 115200, 128000, 134400, 161280, 201600, 230400, 268800,
403200, 460800, 614400, 806400, 921600, 1228800, 2457600, 3000000, 6000000
};
private enum DeviceType { DEVICE_TYPE_01, DEVICE_TYPE_HX};
private enum DeviceType { DEVICE_TYPE_01, DEVICE_TYPE_HX}
private final UsbDevice mDevice;
private final UsbSerialPort mPort;
@@ -502,7 +502,7 @@ public class ProlificSerialDriver implements UsbSerialDriver {
}
public static Map<Integer, int[]> getSupportedDevices() {
final Map<Integer, int[]> supportedDevices = new LinkedHashMap<Integer, int[]>();
final Map<Integer, int[]> supportedDevices = new LinkedHashMap<>();
supportedDevices.put(UsbId.VENDOR_PROLIFIC,
new int[] { UsbId.PROLIFIC_PL2303, });
return supportedDevices;
@@ -46,11 +46,11 @@ public class UsbSerialProber {
* not require permission from the Android USB system, since it does not
* open any of the devices.
*
* @param usbManager
* @param usbManager usb manager
* @return a list, possibly empty, of all compatible drivers
*/
public List<UsbSerialDriver> findAllDrivers(final UsbManager usbManager) {
final List<UsbSerialDriver> result = new ArrayList<UsbSerialDriver>();
final List<UsbSerialDriver> result = new ArrayList<>();
for (final UsbDevice usbDevice : usbManager.getDeviceList().values()) {
final UsbSerialDriver driver = probeDevice(usbDevice);
@@ -52,12 +52,12 @@ public class SerialInputOutputManager implements Runnable {
/**
* Called when new incoming data is available.
*/
public void onNewData(byte[] data);
void onNewData(byte[] data);
/**
* Called when {@link SerialInputOutputManager#run()} aborts due to an error.
*/
public void onRunError(Exception e);
void onRunError(Exception e);
}
public SerialInputOutputManager(UsbSerialPort serialPort) {
@@ -200,7 +200,7 @@ public class SerialInputOutputManager implements Runnable {
private void step() throws IOException {
// Handle incoming data.
byte[] buffer = null;
byte[] buffer;
synchronized (mReadBufferLock) {
buffer = mReadBuffer.array();
}