Skip to content

Commit

Permalink
fix IDEA warning "Field can be final"
Browse files Browse the repository at this point in the history
  • Loading branch information
asolntsev committed Jan 8, 2024
1 parent f84e645 commit 68c80dd
Show file tree
Hide file tree
Showing 29 changed files with 67 additions and 67 deletions.
32 changes: 16 additions & 16 deletions java/src/org/openqa/selenium/devtools/CdpClientGenerator.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
}

private static class Model {
private List<Domain> domains = new ArrayList<>();
private String basePackage;
private final List<Domain> domains = new ArrayList<>();
private final String basePackage;

public Model(String basePackage) {
this.basePackage = basePackage;
Expand Down Expand Up @@ -148,7 +148,7 @@ public void dumpTo(Path target) {
}

private static class Parser<T extends BaseSpec> {
private Map<String, BiConsumer<T, Object>> processors;
private final Map<String, BiConsumer<T, Object>> processors;

public Parser(Map<String, BiConsumer<T, Object>> processors) {
this.processors = processors;
Expand Down Expand Up @@ -246,11 +246,11 @@ public TypedSpecParser(boolean inline, Map<String, BiConsumer<T, Object>> extraP
}

private static class Domain extends BaseSpec {
private Model model;
private final Model model;

private List<TypeSpec> types = new ArrayList<>();
private List<CommandSpec> commands = new ArrayList<>();
private List<EventSpec> events = new ArrayList<>();
private final List<TypeSpec> types = new ArrayList<>();
private final List<CommandSpec> commands = new ArrayList<>();
private final List<EventSpec> events = new ArrayList<>();

public Domain(Model model) {
this.model = model;
Expand Down Expand Up @@ -776,8 +776,8 @@ public String getMapper() {
}

private static class SimpleType implements IType {
private String name;
private String type;
private final String name;
private final String type;

public SimpleType(String name, String type) {
this.name = name;
Expand Down Expand Up @@ -1034,9 +1034,9 @@ public String getJavaType() {

private static class ObjectType implements IType {

private TypedSpec parent;
private String name;
private List<VariableSpec> properties;
private final TypedSpec parent;
private final String name;
private final List<VariableSpec> properties;

public ObjectType(TypedSpec parent, String name, List<VariableSpec> properties) {
this.parent = parent;
Expand Down Expand Up @@ -1184,7 +1184,7 @@ public String getMapper() {

private static class ArrayType implements IType {
private IType itemType;
private String name;
private final String name;

public ArrayType(String name) {
this.name = name;
Expand Down Expand Up @@ -1263,9 +1263,9 @@ public void parse(Domain domain, Map<String, Object> json) {
}

private static class RefType implements IType {
private String name;
private Domain domain;
private String type;
private final String name;
private final Domain domain;
private final String type;

public RefType(String name, Domain domain, String type) {
this.name = name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

public class NoOpDomains implements Domains {

private static BuildInfo INFO = new BuildInfo();
private static final BuildInfo INFO = new BuildInfo();

private static final String WARNING =
String.format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class UnboundZmqEventBus implements EventBus {
private final Map<EventName, List<Consumer<Event>>> listeners = new ConcurrentHashMap<>();
private final Queue<UUID> recentMessages = EvictingQueue.create(128);
private final String encodedSecret;
private ZMQ.Poller poller;
private final ZMQ.Poller poller;

private ZMQ.Socket pub;
private ZMQ.Socket sub;
Expand Down
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/firefox/FirefoxDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public class FirefoxDriver extends RemoteWebDriver
private final Optional<URI> biDiUri;
private Connection connection;
private DevTools devTools;
private Optional<BiDi> biDi;
private final Optional<BiDi> biDi;

/**
* Creates a new FirefoxDriver using the {@link GeckoDriverService#createDefaultService)} server
Expand Down
4 changes: 2 additions & 2 deletions java/src/org/openqa/selenium/firefox/Preferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class Preferences {
private static final Pattern PREFERENCE_PATTERN =
Pattern.compile("user_pref\\(\"([^\"]+)\", (\"?.+?\"?)\\);");

private Map<String, Object> immutablePrefs = new HashMap<>();
private Map<String, Object> allPrefs = new HashMap<>();
private final Map<String, Object> immutablePrefs = new HashMap<>();
private final Map<String, Object> allPrefs = new HashMap<>();

public Preferences() {}

Expand Down
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/firefox/ProfilesIni.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.openqa.selenium.io.TemporaryFilesystem;

public class ProfilesIni {
private Map<String, File> profiles;
private final Map<String, File> profiles;

public ProfilesIni() {
File appData = locateAppDataDirectory(Platform.getCurrent());
Expand Down
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/json/JsonInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class JsonInput implements Closeable {

private final Reader source;
// FIXME: This flag is never set
private volatile boolean readPerformed = false;
private final boolean readPerformed = false;
private JsonTypeCoercer coercer;
private PropertySetting setter;
private final Input input;
Expand Down
4 changes: 2 additions & 2 deletions java/src/org/openqa/selenium/logging/CompositeLocalLogs.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
* LocalLogs instance.
*/
class CompositeLocalLogs extends LocalLogs {
private LocalLogs predefinedTypeLogger;
private LocalLogs allTypesLogger;
private final LocalLogs predefinedTypeLogger;
private final LocalLogs allTypesLogger;

protected CompositeLocalLogs(LocalLogs predefinedTypeLogger, LocalLogs allTypesLogger) {
super();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ private enum Continuation {
private static final Logger LOG = Logger.getLogger(MessageInboundConverter.class.getName());

private Continuation next;
private StringBuilder builder;
private ByteArrayOutputStream buffer;
private final StringBuilder builder;
private final ByteArrayOutputStream buffer;

public MessageInboundConverter() {
next = Continuation.None;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@

class SeleniumHttpInitializer extends ChannelInitializer<SocketChannel> {

private static AttributeKey<Consumer<Message>> KEY = AttributeKey.newInstance("se-ws-handler");
private HttpHandler seleniumHandler;
private static final AttributeKey<Consumer<Message>> KEY = AttributeKey.newInstance("se-ws-handler");
private final HttpHandler seleniumHandler;
private final BiFunction<String, Consumer<Message>, Optional<Consumer<Message>>> webSocketHandler;
private SslContext sslCtx;
private final SslContext sslCtx;
private final boolean allowCors;

SeleniumHttpInitializer(
Expand Down
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/os/OsProcess.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class OsProcess {
private final Executor executor = new DaemonExecutor();

private volatile OutputStream drainTo;
private SeleniumWatchDog executeWatchdog = new SeleniumWatchDog(ExecuteWatchdog.INFINITE_TIMEOUT);
private final SeleniumWatchDog executeWatchdog = new SeleniumWatchDog(ExecuteWatchdog.INFINITE_TIMEOUT);
private PumpStreamHandler streamHandler;

private final org.apache.commons.exec.CommandLine cl;
Expand Down
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/remote/ErrorHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public class ErrorHandler {
private static final String UNKNOWN_METHOD = "<anonymous method>";
private static final String UNKNOWN_FILE = null;

private ErrorCodes errorCodes;
private final ErrorCodes errorCodes;

private boolean includeServerErrors;

Expand Down
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/remote/http/Contents.java
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private static final class MemoizedSupplier implements Supplier<InputStream> {

private volatile boolean initialized;
private volatile FileBackedOutputStream fos;
private Supplier<InputStream> delegate;
private final Supplier<InputStream> delegate;

private MemoizedSupplier(Supplier<InputStream> delegate) {
this.delegate = delegate;
Expand Down
6 changes: 3 additions & 3 deletions java/src/org/openqa/selenium/support/ByIdOrName.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public class ByIdOrName extends By implements Serializable {

private static final long serialVersionUID = 3986638402799576701L;

private By idFinder;
private By nameFinder;
private String idOrName;
private final By idFinder;
private final By nameFinder;
private final String idOrName;

public ByIdOrName(String idOrName) {
this.idOrName = idOrName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,9 @@ public void refresh() {
}
}

private class EventFiringOptions implements Options {
private static class EventFiringOptions implements Options {

private Options options;
private final Options options;

private EventFiringOptions(Options options) {
this.options = options;
Expand Down Expand Up @@ -647,7 +647,7 @@ public Window window() {
}
}

private class EventFiringTimeouts implements Timeouts {
private static class EventFiringTimeouts implements Timeouts {

private final Timeouts timeouts;

Expand Down Expand Up @@ -710,7 +710,7 @@ public Duration getPageLoadTimeout() {

private class EventFiringTargetLocator implements TargetLocator {

private TargetLocator targetLocator;
private final TargetLocator targetLocator;

private EventFiringTargetLocator(TargetLocator targetLocator) {
this.targetLocator = targetLocator;
Expand Down Expand Up @@ -769,7 +769,7 @@ public Alert alert() {
}

@Beta
private class EventFiringWindow implements Window {
private static class EventFiringWindow implements Window {
private final Window window;

EventFiringWindow(Window window) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class ByAll extends By implements Serializable {

private static final long serialVersionUID = 4573668832699497306L;

private By[] bys;
private final By[] bys;

public ByAll(By... bys) {
this.bys = bys;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class ByChained extends By implements Serializable {

private static final long serialVersionUID = 1563769051170172451L;

private By[] bys;
private final By[] bys;

public ByChained(By... bys) {
this.bys = bys;
Expand Down
2 changes: 1 addition & 1 deletion java/src/org/openqa/selenium/support/ui/FluentWait.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public class FluentWait<T> implements Wait<T> {
private Duration interval = DEFAULT_WAIT_DURATION;
private Supplier<String> messageSupplier = () -> null;

private List<Class<? extends Throwable>> ignoredExceptions = new ArrayList<>();
private final List<Class<? extends Throwable>> ignoredExceptions = new ArrayList<>();

/**
* @param input The input value to pass to the evaluated conditions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
import org.openqa.selenium.remote.tracing.Tracer;

class ReverseProxyHandlerTest {
private Tracer tracer = DefaultTestTracer.createTracer();
private HttpClient.Factory factory = HttpClient.Factory.createDefault();
private final Tracer tracer = DefaultTestTracer.createTracer();
private final HttpClient.Factory factory = HttpClient.Factory.createDefault();

@Test
void shouldForwardRequestsToEndPoint()
Expand Down
12 changes: 6 additions & 6 deletions java/test/org/openqa/selenium/json/JsonOutputTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,7 @@ public List<?> getList() {
}

class JsonAware {
private String convertedValue;
private final String convertedValue;

public JsonAware(String convertedValue) {
this.convertedValue = convertedValue;
Expand All @@ -856,7 +856,7 @@ public String toJson() {
}

class MappableJsonAware {
private String convertedValue;
private final String convertedValue;

public MappableJsonAware(String convertedValue) {
this.convertedValue = convertedValue;
Expand All @@ -872,8 +872,8 @@ public Map<String, Object> asMap() {
}

class Mappable1 {
private String key;
private Object value;
private final String key;
private final Object value;

public Mappable1(String key, Object value) {
this.key = key;
Expand All @@ -886,8 +886,8 @@ public Map<String, Object> asMap() {
}

class Mappable2 {
private String key;
private Object value;
private final String key;
private final Object value;

public Mappable2(String key, Object value) {
this.key = key;
Expand Down
4 changes: 2 additions & 2 deletions java/test/org/openqa/selenium/json/JsonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,7 @@ public void setBean(SimpleBean bean) {
}

public static class JsonAware {
private String convertedValue;
private final String convertedValue;

public JsonAware(String convertedValue) {
this.convertedValue = convertedValue;
Expand All @@ -573,7 +573,7 @@ public static JsonAware fromJson(String json) {
}

public static class PrivatelyAware {
private String convertedValue;
private final String convertedValue;

public PrivatelyAware(String convertedValue) {
this.convertedValue = convertedValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public class SimpleHttpServer implements Closeable {

private final Channel channel;

private Map<Map.Entry<HttpMethod, String>, Function<HttpRequest, FullHttpResponse>> endpoints;
private final Map<Map.Entry<HttpMethod, String>, Function<HttpRequest, FullHttpResponse>> endpoints;

public SimpleHttpServer() throws InterruptedException, URISyntaxException {
this(PortProber.findFreePort());
Expand Down
2 changes: 1 addition & 1 deletion java/test/org/openqa/selenium/remote/ErrorCodecTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
@Tag("UnitTests")
public class ErrorCodecTest {

private ErrorCodec errorCodec = ErrorCodec.createDefault();
private final ErrorCodec errorCodec = ErrorCodec.createDefault();

@Test
void encodeW3cSpecExceptions() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected void isLoaded() throws Error {

private static class SlowLoading extends SlowLoadableComponent<SlowLoading> {

private int counts;
private final int counts;
private long loopCount;

public SlowLoading(Clock clock, int timeOutInSeconds, int counts) {
Expand Down
2 changes: 1 addition & 1 deletion java/test/org/openqa/selenium/testing/Safely.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static void safelyCall(TearDownFixture... fixtures) {
try {
CompletableFuture.allOf(futures.toArray(new CompletableFuture[] {})).get(2, TimeUnit.MINUTES);
} catch (TimeoutException ex) {
LOG.log(Level.WARNING, "tear down timed out");
LOG.log(Level.WARNING, "tear down timed out: {}", ex.toString());
} catch (Exception ex) {
LOG.log(Level.WARNING, "tear down failed", ex);
}
Expand Down
2 changes: 1 addition & 1 deletion java/test/org/openqa/selenium/testing/StaticResources.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import org.openqa.selenium.build.InProject;

class StaticResources {
private static Logger LOG = Logger.getLogger(StaticResources.class.getName());
private static final Logger LOG = Logger.getLogger(StaticResources.class.getName());

static void ensureAvailable() {
if (!isInDevMode()) {
Expand Down
Loading

0 comments on commit 68c80dd

Please sign in to comment.