Skip to content

Commit 963d4fb

Browse files
committed
Clean up generics for the JettyServer
1 parent 7678927 commit 963d4fb

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

java/server/src/org/openqa/selenium/jetty/server/JettyServer.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
import static java.util.concurrent.TimeUnit.SECONDS;
5454

55-
public class JettyServer<T extends JettyServer> implements Server<T> {
55+
public class JettyServer implements Server<JettyServer> {
5656

5757
private static final Logger LOG = Logger.getLogger(JettyServer.class.getName());
5858
private static final int MAX_SHUTDOWN_RETRIES = 8;
@@ -155,12 +155,12 @@ public void addServlet(Servlet servlet, String pathSpec) {
155155
}
156156

157157
@Override
158-
public T setHandler(HttpHandler handler) {
158+
public JettyServer setHandler(HttpHandler handler) {
159159
if (server.isRunning()) {
160160
throw new IllegalStateException("You may not add a handler to a running server");
161161
}
162162
this.handler = Objects.requireNonNull(handler, "Handler to use must be set.");
163-
return (T) this;
163+
return this;
164164
}
165165

166166
@Override
@@ -169,7 +169,7 @@ public boolean isStarted() {
169169
}
170170

171171
@Override
172-
public T start() {
172+
public JettyServer start() {
173173
try {
174174
// If there are no routes, we've done something terribly wrong.
175175
if (handler == null) {
@@ -182,8 +182,7 @@ public T start() {
182182

183183
PortProber.waitForPortUp(getUrl().getPort(), 10, SECONDS);
184184

185-
//noinspection unchecked
186-
return (T) this;
185+
return this;
187186
} catch (Exception e) {
188187
try {
189188
stop();

java/server/test/org/openqa/selenium/grid/router/EndToEndTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private static Object[] createRemotes() throws URISyntaxException {
188188
LocalNode localNode = LocalNode.builder(bus, clientFactory, nodeUri)
189189
.add(CAPS, createFactory(nodeUri))
190190
.build();
191-
Server<?> nodeServer = new JettyServer<>(
191+
Server<?> nodeServer = new JettyServer(
192192
new BaseServerOptions(
193193
new MapConfig(ImmutableMap.of("server", ImmutableMap.of("port", port)))));
194194
nodeServer.setHandler(localNode);

0 commit comments

Comments
 (0)