mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Miscellaneous code cleanups.
This commit is contained in:
@@ -21,6 +21,7 @@ import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.ThreadSafe;
|
||||
|
||||
import static com.sun.jna.Library.OPTION_FUNCTION_MAPPER;
|
||||
@@ -163,11 +164,13 @@ class WindowsShutdownManagerImpl extends ShutdownManagerImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
private interface User32 extends StdCallLibrary {
|
||||
|
||||
HWND CreateWindowEx(int styleEx, String className, String windowName,
|
||||
int style, int x, int y, int width, int height, HWND parent,
|
||||
HMENU menu, HINSTANCE instance, Pointer param);
|
||||
int style, int x, int y, int width, int height,
|
||||
@Nullable HWND parent, @Nullable HMENU menu,
|
||||
@Nullable HINSTANCE instance, @Nullable Pointer param);
|
||||
|
||||
LRESULT DefWindowProc(HWND hwnd, int msg, WPARAM wp, LPARAM lp);
|
||||
|
||||
@@ -175,7 +178,8 @@ class WindowsShutdownManagerImpl extends ShutdownManagerImpl {
|
||||
|
||||
LRESULT SetWindowLongPtr(HWND hwnd, int index, WindowProc newProc);
|
||||
|
||||
int GetMessage(MSG msg, HWND hwnd, int filterMin, int filterMax);
|
||||
int GetMessage(MSG msg, @Nullable HWND hwnd, int filterMin,
|
||||
int filterMax);
|
||||
|
||||
boolean TranslateMessage(MSG msg);
|
||||
|
||||
@@ -184,6 +188,7 @@ class WindowsShutdownManagerImpl extends ShutdownManagerImpl {
|
||||
|
||||
private interface WindowProc extends StdCallCallback {
|
||||
|
||||
@SuppressWarnings("UnusedReturnValue")
|
||||
LRESULT callback(HWND hwnd, int msg, WPARAM wp, LPARAM lp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,7 @@ package org.briarproject.bramble.network;
|
||||
|
||||
import org.briarproject.bramble.api.network.NetworkManager;
|
||||
import org.briarproject.bramble.api.network.NetworkStatus;
|
||||
import org.briarproject.bramble.api.nullsafety.MethodsNotNullByDefault;
|
||||
import org.briarproject.bramble.api.nullsafety.ParametersNotNullByDefault;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import java.net.NetworkInterface;
|
||||
import java.net.SocketException;
|
||||
@@ -19,8 +18,7 @@ import static java.util.logging.Level.WARNING;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static org.briarproject.bramble.util.LogUtils.logException;
|
||||
|
||||
@MethodsNotNullByDefault
|
||||
@ParametersNotNullByDefault
|
||||
@NotNullByDefault
|
||||
class JavaNetworkManager implements NetworkManager {
|
||||
|
||||
private static final Logger LOG =
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.concurrent.GuardedBy;
|
||||
|
||||
import jssc.SerialPortEvent;
|
||||
import jssc.SerialPortEventListener;
|
||||
@@ -63,9 +64,12 @@ class ModemImpl implements Modem, WriteHandler, SerialPortEventListener {
|
||||
private final Condition connectedStateChanged = lock.newCondition();
|
||||
private final Condition initialisedStateChanged = lock.newCondition();
|
||||
|
||||
// The following are locking: lock
|
||||
@GuardedBy("lock")
|
||||
private ReliabilityLayer reliability = null;
|
||||
private boolean initialised = false, connected = false;
|
||||
@GuardedBy("lock")
|
||||
private boolean initialised = false;
|
||||
@GuardedBy("lock")
|
||||
private boolean connected = false;
|
||||
|
||||
private int lineLen = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user