diff --git a/java/client/src/org/openqa/selenium/interactions/CompositeAction.java b/java/client/src/org/openqa/selenium/interactions/CompositeAction.java index 9ee6040e8335e..8ae463ea53279 100644 --- a/java/client/src/org/openqa/selenium/interactions/CompositeAction.java +++ b/java/client/src/org/openqa/selenium/interactions/CompositeAction.java @@ -63,7 +63,7 @@ int getNumberOfActions() { } public List asList() { - ImmutableList.Builder builder = new ImmutableList.Builder(); + ImmutableList.Builder builder = new ImmutableList.Builder<>(); for (Action action : actionsList) { if (action instanceof MultiAction) { builder.addAll(((MultiAction) action).getActions()); diff --git a/java/client/src/org/openqa/selenium/io/TemporaryFilesystem.java b/java/client/src/org/openqa/selenium/io/TemporaryFilesystem.java index bf49cd82c77d5..762d284e5687e 100644 --- a/java/client/src/org/openqa/selenium/io/TemporaryFilesystem.java +++ b/java/client/src/org/openqa/selenium/io/TemporaryFilesystem.java @@ -29,7 +29,7 @@ */ public class TemporaryFilesystem { - private final Set temporaryFiles = new CopyOnWriteArraySet(); + private final Set temporaryFiles = new CopyOnWriteArraySet<>(); private final File baseDir; private final Thread shutdownHook = new Thread() { // Thread safety reviewed @Override diff --git a/java/client/src/org/openqa/selenium/os/ExecutableFinder.java b/java/client/src/org/openqa/selenium/os/ExecutableFinder.java index 77734bc52c026..02cdc783139d4 100644 --- a/java/client/src/org/openqa/selenium/os/ExecutableFinder.java +++ b/java/client/src/org/openqa/selenium/os/ExecutableFinder.java @@ -39,7 +39,7 @@ class ExecutableFinder { private static final Method JDK6_CAN_EXECUTE = findJdk6CanExecuteMethod(); private final ImmutableSet.Builder pathSegmentBuilder = - new ImmutableSet.Builder(); + new ImmutableSet.Builder<>(); /** * Find the executable by scanning the file system and the PATH. In the case of Windows this diff --git a/java/client/src/org/openqa/selenium/remote/RemoteLogs.java b/java/client/src/org/openqa/selenium/remote/RemoteLogs.java index 8b1d3c30317f1..0c4e94b39f645 100644 --- a/java/client/src/org/openqa/selenium/remote/RemoteLogs.java +++ b/java/client/src/org/openqa/selenium/remote/RemoteLogs.java @@ -103,7 +103,7 @@ public Set getAvailableLogTypes() { Object raw = executeMethod.execute(DriverCommand.GET_AVAILABLE_LOG_TYPES, null); @SuppressWarnings("unchecked") List rawList = (List) raw; - ImmutableSet.Builder builder = new ImmutableSet.Builder(); + ImmutableSet.Builder builder = new ImmutableSet.Builder<>(); for (String logType : rawList) { builder.add(logType); } diff --git a/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java b/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java index 3840a02e6683b..34365466b0c0b 100644 --- a/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java +++ b/java/client/src/org/openqa/selenium/remote/RemoteWebDriver.java @@ -169,7 +169,7 @@ private void init(Capabilities desiredCapabilities, Capabilities requiredCapabil keyboard = new RemoteKeyboard(executeMethod); mouse = new RemoteMouse(executeMethod); - ImmutableSet.Builder builder = new ImmutableSet.Builder(); + ImmutableSet.Builder builder = new ImmutableSet.Builder<>(); boolean isProfilingEnabled = desiredCapabilities != null && desiredCapabilities.is(CapabilityType.ENABLE_PROFILING_CAPABILITY); @@ -237,7 +237,7 @@ protected void startSession(Capabilities desiredCapabilities) { protected void startSession(Capabilities desiredCapabilities, Capabilities requiredCapabilities) { ImmutableMap.Builder paramBuilder = - new ImmutableMap.Builder(); + new ImmutableMap.Builder<>(); paramBuilder.put("desiredCapabilities", desiredCapabilities); if (requiredCapabilities != null) { paramBuilder.put("requiredCapabilities", requiredCapabilities); @@ -546,7 +546,7 @@ public Set getWindowHandles() { Object value = response.getValue(); try { List returnedValues = (List) value; - return new LinkedHashSet(returnedValues); + return new LinkedHashSet<>(returnedValues); } catch (ClassCastException ex) { throw new WebDriverException( "Returned value cannot be converted to List: " + value, ex); diff --git a/java/client/src/org/openqa/selenium/safari/SafariDriverServer.java b/java/client/src/org/openqa/selenium/safari/SafariDriverServer.java index 48adffa2a4b21..6390b91c342b5 100644 --- a/java/client/src/org/openqa/selenium/safari/SafariDriverServer.java +++ b/java/client/src/org/openqa/selenium/safari/SafariDriverServer.java @@ -47,7 +47,7 @@ class SafariDriverServer { private final int port; private final BlockingQueue connections = - new SynchronousQueue(); + new SynchronousQueue<>(); private ServerBootstrap bootstrap; private Channel serverChannel; diff --git a/java/client/src/org/openqa/selenium/safari/WebSocketConnection.java b/java/client/src/org/openqa/selenium/safari/WebSocketConnection.java index 5756e3af0143e..74934434488c1 100644 --- a/java/client/src/org/openqa/selenium/safari/WebSocketConnection.java +++ b/java/client/src/org/openqa/selenium/safari/WebSocketConnection.java @@ -50,7 +50,7 @@ class WebSocketConnection { private final Channel channel; private final AtomicReference> pendingResponse = - new AtomicReference>(); + new AtomicReference<>(); public WebSocketConnection(Channel channel) { this.channel = channel; diff --git a/java/client/test/org/openqa/selenium/remote/RemoteLogsTest.java b/java/client/test/org/openqa/selenium/remote/RemoteLogsTest.java index 4703827b60642..a80acf57a8945 100644 --- a/java/client/test/org/openqa/selenium/remote/RemoteLogsTest.java +++ b/java/client/test/org/openqa/selenium/remote/RemoteLogsTest.java @@ -60,7 +60,7 @@ public void createMocksAndRemoteLogs() { @Test public void canGetProfilerLogs() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); entries.add(new LogEntry(Level.INFO, 0, "hello")); when(localLogs.get(LogType.PROFILER)).thenReturn(new LogEntries(entries)); @@ -79,7 +79,7 @@ public void canGetProfilerLogs() { @Test public void canGetLocalProfilerLogsIfNoRemoteProfilerLogSupport() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); entries.add(new LogEntry(Level.INFO, 0, "hello")); when(localLogs.get(LogType.PROFILER)).thenReturn(new LogEntries(entries)); @@ -97,7 +97,7 @@ public void canGetLocalProfilerLogsIfNoRemoteProfilerLogSupport() { @Test public void canGetClientLogs() { - List entries = new ArrayList(); + List entries = new ArrayList<>(); entries.add(new LogEntry(Level.SEVERE, 0, "hello")); when(localLogs.get(LogType.CLIENT)).thenReturn(new LogEntries(entries)); @@ -127,20 +127,20 @@ public void canGetServerLogs() { @Test public void canGetAvailableLogTypes() { - List remoteAvailableLogTypes = new ArrayList(); + List remoteAvailableLogTypes = new ArrayList<>(); remoteAvailableLogTypes.add(LogType.PROFILER); remoteAvailableLogTypes.add(LogType.SERVER); when(executeMethod.execute(DriverCommand.GET_AVAILABLE_LOG_TYPES, null)) .thenReturn(remoteAvailableLogTypes); - Set localAvailableLogTypes = new HashSet(); + Set localAvailableLogTypes = new HashSet<>(); localAvailableLogTypes.add(LogType.PROFILER); localAvailableLogTypes.add(LogType.CLIENT); when(localLogs.getAvailableLogTypes()).thenReturn(localAvailableLogTypes); - Set expected = new HashSet(); + Set expected = new HashSet<>(); expected.add(LogType.CLIENT); expected.add(LogType.PROFILER); expected.add(LogType.SERVER); diff --git a/java/client/test/org/openqa/selenium/support/ui/ExpectedConditionsTest.java b/java/client/test/org/openqa/selenium/support/ui/ExpectedConditionsTest.java index eff4e21685cb3..0df53661bb95a 100644 --- a/java/client/test/org/openqa/selenium/support/ui/ExpectedConditionsTest.java +++ b/java/client/test/org/openqa/selenium/support/ui/ExpectedConditionsTest.java @@ -100,7 +100,7 @@ public class ExpectedConditionsTest { public void setUpMocks() { MockitoAnnotations.initMocks(this); - wait = new FluentWait(mockDriver, mockClock, mockSleeper) + wait = new FluentWait<>(mockDriver, mockClock, mockSleeper) .withTimeout(1, TimeUnit.SECONDS) .pollingEvery(250, TimeUnit.MILLISECONDS); } diff --git a/java/client/test/org/openqa/selenium/support/ui/FluentWaitTest.java b/java/client/test/org/openqa/selenium/support/ui/FluentWaitTest.java index 8d5a3abe26c34..43a3838ac16cc 100644 --- a/java/client/test/org/openqa/selenium/support/ui/FluentWaitTest.java +++ b/java/client/test/org/openqa/selenium/support/ui/FluentWaitTest.java @@ -67,7 +67,7 @@ public void shouldWaitUntilReturnValueOfConditionIsNotNull() throws InterruptedE when(mockClock.isNowBefore(2L)).thenReturn(true); when(mockCondition.apply(mockDriver)).thenReturn(null, ARBITRARY_VALUE); - Wait wait = new FluentWait(mockDriver, mockClock, mockSleeper) + Wait wait = new FluentWait<>(mockDriver, mockClock, mockSleeper) .withTimeout(0, TimeUnit.MILLISECONDS) .pollingEvery(2, TimeUnit.SECONDS) .ignoring(NoSuchElementException.class, NoSuchFrameException.class); @@ -82,7 +82,7 @@ public void shouldWaitUntilABooleanResultIsTrue() throws InterruptedException { when(mockClock.isNowBefore(2L)).thenReturn(true); when(mockCondition.apply(mockDriver)).thenReturn(false, false, true); - Wait wait = new FluentWait(mockDriver, mockClock, mockSleeper) + Wait wait = new FluentWait<>(mockDriver, mockClock, mockSleeper) .withTimeout(0, TimeUnit.MILLISECONDS) .pollingEvery(2, TimeUnit.SECONDS) .ignoring(NoSuchElementException.class, NoSuchFrameException.class); @@ -98,7 +98,7 @@ public void checksTimeoutAfterConditionSoZeroTimeoutWaitsCanSucceed() { when(mockClock.isNowBefore(2L)).thenReturn(false); when(mockCondition.apply(mockDriver)).thenReturn(null); - Wait wait = new FluentWait(mockDriver, mockClock, mockSleeper) + Wait wait = new FluentWait<>(mockDriver, mockClock, mockSleeper) .withTimeout(0, TimeUnit.MILLISECONDS); try { wait.until(mockCondition); @@ -117,7 +117,7 @@ public void canIgnoreMultipleExceptions() throws InterruptedException { .thenThrow(new NoSuchFrameException("")) .thenReturn(ARBITRARY_VALUE); - Wait wait = new FluentWait(mockDriver, mockClock, mockSleeper) + Wait wait = new FluentWait<>(mockDriver, mockClock, mockSleeper) .withTimeout(0, TimeUnit.MILLISECONDS) .pollingEvery(2, TimeUnit.SECONDS) .ignoring(NoSuchElementException.class, NoSuchFrameException.class); @@ -134,7 +134,7 @@ public void propagatesUnIgnoredExceptions() { when(mockClock.laterBy(0L)).thenReturn(2L); when(mockCondition.apply(mockDriver)).thenThrow(exception); - Wait wait = new FluentWait(mockDriver, mockClock, mockSleeper) + Wait wait = new FluentWait<>(mockDriver, mockClock, mockSleeper) .withTimeout(0, TimeUnit.MILLISECONDS) .pollingEvery(2, TimeUnit.SECONDS) .ignoring(NoSuchElementException.class, NoSuchFrameException.class); @@ -157,7 +157,7 @@ public void timeoutMessageIncludesLastIgnoredException() { .thenReturn(null); when(mockClock.isNowBefore(2L)).thenReturn(false); - Wait wait = new FluentWait(mockDriver, mockClock, mockSleeper) + Wait wait = new FluentWait<>(mockDriver, mockClock, mockSleeper) .withTimeout(0, TimeUnit.MILLISECONDS) .pollingEvery(2, TimeUnit.SECONDS) .ignoring(NoSuchWindowException.class); @@ -179,7 +179,7 @@ public void timeoutMessageIncludesCustomMessage() { when(mockCondition.apply(mockDriver)).thenReturn(null); when(mockClock.isNowBefore(2L)).thenReturn(false); - Wait wait = new FluentWait(mockDriver, mockClock, mockSleeper) + Wait wait = new FluentWait<>(mockDriver, mockClock, mockSleeper) .withTimeout(0, TimeUnit.MILLISECONDS) .withMessage("Expected custom timeout message"); @@ -203,7 +203,7 @@ public void timeoutMessageIncludesCustomMessageEvaluatedOnFailure() { when(mockCondition.apply(mockDriver)).thenReturn(null); when(mockClock.isNowBefore(2L)).thenReturn(false); - Wait wait = new FluentWait(mockDriver, mockClock, mockSleeper) + Wait wait = new FluentWait<>(mockDriver, mockClock, mockSleeper) .withTimeout(0, TimeUnit.MILLISECONDS) .withMessage(new Supplier() { @Override @@ -258,7 +258,7 @@ public void canIgnoreThrowables() { when(mockCondition.apply(mockDriver)).thenThrow(exception); when(mockClock.isNowBefore(2L)).thenReturn(false); - Wait wait = new FluentWait(mockDriver, mockClock, mockSleeper) + Wait wait = new FluentWait<>(mockDriver, mockClock, mockSleeper) .withTimeout(0, TimeUnit.MILLISECONDS) .pollingEvery(2, TimeUnit.SECONDS) .ignoring(AssertionError.class); diff --git a/java/client/test/org/openqa/selenium/testing/drivers/OutOfProcessSeleniumServer.java b/java/client/test/org/openqa/selenium/testing/drivers/OutOfProcessSeleniumServer.java index 14222162fa860..87960c0a9326d 100644 --- a/java/client/test/org/openqa/selenium/testing/drivers/OutOfProcessSeleniumServer.java +++ b/java/client/test/org/openqa/selenium/testing/drivers/OutOfProcessSeleniumServer.java @@ -69,7 +69,7 @@ public OutOfProcessSeleniumServer start() { String localAddress = new NetworkUtils().getPrivateLocalAddress(); baseUrl = String.format("http://%s:%d", localAddress, port); - List cmdLine = new LinkedList(); + List cmdLine = new LinkedList<>(); cmdLine.add("java"); cmdLine.add("-cp"); cmdLine.add(classPath); diff --git a/java/server/src/org/openqa/grid/internal/ProxySet.java b/java/server/src/org/openqa/grid/internal/ProxySet.java index 86396c7575796..b5f85a6da97c5 100644 --- a/java/server/src/org/openqa/grid/internal/ProxySet.java +++ b/java/server/src/org/openqa/grid/internal/ProxySet.java @@ -41,7 +41,7 @@ @ThreadSafe public class ProxySet implements Iterable { - private final Set proxies = new CopyOnWriteArraySet(); + private final Set proxies = new CopyOnWriteArraySet<>(); private static final Logger log = Logger.getLogger(ProxySet.class.getName()); private volatile boolean throwOnCapabilityNotPresent = true; diff --git a/java/server/src/org/openqa/grid/internal/Registry.java b/java/server/src/org/openqa/grid/internal/Registry.java index 843e92d32d60b..d3dbd667fd43e 100644 --- a/java/server/src/org/openqa/grid/internal/Registry.java +++ b/java/server/src/org/openqa/grid/internal/Registry.java @@ -59,7 +59,7 @@ public class Registry { private final HttpClientFactory httpClientFactory; private final NewSessionRequestQueue newSessionQueue; private final Matcher matcherThread = new Matcher(); - private final List registeringProxies = new CopyOnWriteArrayList(); + private final List registeringProxies = new CopyOnWriteArrayList<>(); private volatile boolean stop = false; // The following three variables need to be volatile because we expose a public setters diff --git a/java/server/src/org/openqa/grid/selenium/proxy/DefaultRemoteProxy.java b/java/server/src/org/openqa/grid/selenium/proxy/DefaultRemoteProxy.java index f4a26f9717e69..754e5b3ab448d 100644 --- a/java/server/src/org/openqa/grid/selenium/proxy/DefaultRemoteProxy.java +++ b/java/server/src/org/openqa/grid/selenium/proxy/DefaultRemoteProxy.java @@ -107,7 +107,7 @@ public HtmlRenderer getHtmlRender() { private volatile boolean poll = true; // TODO freynaud - private List errors = new CopyOnWriteArrayList(); + private List errors = new CopyOnWriteArrayList<>(); private Thread pollingThread = null; public boolean isAlive() { diff --git a/java/server/src/org/openqa/selenium/remote/server/CapabilitiesComparator.java b/java/server/src/org/openqa/selenium/remote/server/CapabilitiesComparator.java index 3d9b6b13852ab..d86d996df29e4 100644 --- a/java/server/src/org/openqa/selenium/remote/server/CapabilitiesComparator.java +++ b/java/server/src/org/openqa/selenium/remote/server/CapabilitiesComparator.java @@ -156,7 +156,7 @@ public int score(T value) { } static CapabilityScorer scoreAgainst(T value) { - return new CapabilityScorer(value); + return new CapabilityScorer<>(value); } } diff --git a/java/server/src/org/openqa/selenium/remote/server/DefaultSession.java b/java/server/src/org/openqa/selenium/remote/server/DefaultSession.java index 2167d323d5bf3..81c04e1e3ebfd 100644 --- a/java/server/src/org/openqa/selenium/remote/server/DefaultSession.java +++ b/java/server/src/org/openqa/selenium/remote/server/DefaultSession.java @@ -110,7 +110,7 @@ private DefaultSession(final DriverFactory factory, TemporaryFilesystem tempFs, this.clock = clock; final BrowserCreator browserCreator = new BrowserCreator(factory, capabilities); final FutureTask webDriverFutureTask = - new FutureTask(browserCreator); + new FutureTask<>(browserCreator); executor = new ThreadPoolExecutor(1, 1, 600L, TimeUnit.SECONDS, new LinkedBlockingQueue()); diff --git a/java/server/src/org/openqa/selenium/remote/server/JsonHttpCommandHandler.java b/java/server/src/org/openqa/selenium/remote/server/JsonHttpCommandHandler.java index 057d0de186b6a..9e026be23cb5e 100644 --- a/java/server/src/org/openqa/selenium/remote/server/JsonHttpCommandHandler.java +++ b/java/server/src/org/openqa/selenium/remote/server/JsonHttpCommandHandler.java @@ -48,7 +48,7 @@ public class JsonHttpCommandHandler { private final Logger log; private final JsonHttpCommandCodec commandCodec; private final JsonHttpResponseCodec responseCodec; - private final Map configs = new LinkedHashMap(); + private final Map configs = new LinkedHashMap<>(); private final ErrorCodes errorCodes = new ErrorCodes(); public JsonHttpCommandHandler(DriverSessions sessions, Logger log) { diff --git a/java/server/src/org/openqa/selenium/remote/server/handler/SendKeys.java b/java/server/src/org/openqa/selenium/remote/server/handler/SendKeys.java index 7ef058946217d..17791de89558d 100644 --- a/java/server/src/org/openqa/selenium/remote/server/handler/SendKeys.java +++ b/java/server/src/org/openqa/selenium/remote/server/handler/SendKeys.java @@ -28,7 +28,7 @@ public class SendKeys extends WebElementHandler implements JsonParametersAware { - private final List keys = new CopyOnWriteArrayList(); + private final List keys = new CopyOnWriteArrayList<>(); public SendKeys(Session session) { super(session); diff --git a/java/server/src/org/openqa/selenium/remote/server/handler/WebDriverHandler.java b/java/server/src/org/openqa/selenium/remote/server/handler/WebDriverHandler.java index fbe491013a584..03939b0bf2be3 100644 --- a/java/server/src/org/openqa/selenium/remote/server/handler/WebDriverHandler.java +++ b/java/server/src/org/openqa/selenium/remote/server/handler/WebDriverHandler.java @@ -40,7 +40,7 @@ protected WebDriverHandler(Session session) { @Override public final T handle() throws Exception { - FutureTask future = new FutureTask(this); + FutureTask future = new FutureTask<>(this); try { return getSession().execute(future); } catch (ExecutionException e) { diff --git a/java/server/src/org/openqa/selenium/remote/server/handler/interactions/SendKeyToActiveElement.java b/java/server/src/org/openqa/selenium/remote/server/handler/interactions/SendKeyToActiveElement.java index 02e7def21f9b5..953e8bd67914d 100644 --- a/java/server/src/org/openqa/selenium/remote/server/handler/interactions/SendKeyToActiveElement.java +++ b/java/server/src/org/openqa/selenium/remote/server/handler/interactions/SendKeyToActiveElement.java @@ -30,7 +30,7 @@ public class SendKeyToActiveElement extends WebDriverHandler implements JsonParametersAware { - private final List keys = new CopyOnWriteArrayList(); + private final List keys = new CopyOnWriteArrayList<>(); public SendKeyToActiveElement(Session session) { super(session); diff --git a/java/server/src/org/openqa/selenium/remote/server/log/DefaultPerSessionLogHandler.java b/java/server/src/org/openqa/selenium/remote/server/log/DefaultPerSessionLogHandler.java index ba988daaaaa22..55b11d84a37a0 100644 --- a/java/server/src/org/openqa/selenium/remote/server/log/DefaultPerSessionLogHandler.java +++ b/java/server/src/org/openqa/selenium/remote/server/log/DefaultPerSessionLogHandler.java @@ -276,7 +276,7 @@ public synchronized LogEntries getSessionLog(SessionId sessionId) throws IOExcep public synchronized List getLoggedSessions() { // TODO: Find a solution that can handle large numbers of sessions, maybe by // reading them from disc. - ImmutableList.Builder builder = new ImmutableList.Builder(); + ImmutableList.Builder builder = new ImmutableList.Builder<>(); builder.addAll(perSessionDriverEntries.keySet()); return builder.build(); } diff --git a/java/server/src/org/openqa/selenium/server/htmlrunner/HTMLTestResults.java b/java/server/src/org/openqa/selenium/server/htmlrunner/HTMLTestResults.java index d99a2e766074d..cf798837e4c55 100644 --- a/java/server/src/org/openqa/selenium/server/htmlrunner/HTMLTestResults.java +++ b/java/server/src/org/openqa/selenium/server/htmlrunner/HTMLTestResults.java @@ -240,7 +240,7 @@ public String decode(String string) { } public List decodeListOfStrings(List list) { - List decodedList = new LinkedList(); + List decodedList = new LinkedList<>(); for (Object o : list) { decodedList.add(decode((String) o)); diff --git a/java/server/test/org/openqa/selenium/remote/server/SessionCleanerTest.java b/java/server/test/org/openqa/selenium/remote/server/SessionCleanerTest.java index 2463c255b9c79..c55ddc237147a 100644 --- a/java/server/test/org/openqa/selenium/remote/server/SessionCleanerTest.java +++ b/java/server/test/org/openqa/selenium/remote/server/SessionCleanerTest.java @@ -89,7 +89,7 @@ private Runnable getRunnableThatMakesSessionBusy(final Session session, return new Runnable() { public void run() { try { - session.execute(new FutureTask(new Callable() + session.execute(new FutureTask<>(new Callable() { public Object call() { try {