Skip to content

Commit 95d3783

Browse files
committed
#13489 remove internal types from signatures of publicly-defined APIs
Signed-off-by: Ludovic Orban <[email protected]>
1 parent 4ec3ad6 commit 95d3783

File tree

3 files changed

+21
-18
lines changed

3 files changed

+21
-18
lines changed

jetty-core/jetty-http3/jetty-http3-client/src/main/java/org/eclipse/jetty/http3/client/HTTP3SessionClient.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.eclipse.jetty.http3.HTTP3ErrorCode;
1919
import org.eclipse.jetty.http3.HTTP3Exception;
2020
import org.eclipse.jetty.http3.HTTP3Session;
21+
import org.eclipse.jetty.http3.HTTP3Stream;
2122
import org.eclipse.jetty.http3.api.Session;
2223
import org.eclipse.jetty.http3.api.Stream;
2324
import org.eclipse.jetty.http3.client.internal.ClientHTTP3Session;
@@ -26,6 +27,7 @@
2627
import org.eclipse.jetty.http3.frames.GoAwayFrame;
2728
import org.eclipse.jetty.http3.frames.HeadersFrame;
2829
import org.eclipse.jetty.http3.frames.SettingsFrame;
30+
import org.eclipse.jetty.quic.common.ProtocolSession;
2931
import org.eclipse.jetty.quic.common.ProtocolStreamListener;
3032
import org.eclipse.jetty.quic.common.StreamEndPoint;
3133
import org.eclipse.jetty.util.Callback;
@@ -40,16 +42,17 @@ public class HTTP3SessionClient extends HTTP3Session implements Session.Client
4042

4143
private final Promise.Invocable<Client> promise;
4244

43-
public HTTP3SessionClient(Scheduler scheduler, ClientHTTP3Session session, Client.Listener listener, Promise.Invocable<Client> promise)
45+
public HTTP3SessionClient(Scheduler scheduler, ProtocolSession session, Client.Listener listener, Promise.Invocable<Client> promise)
4446
{
4547
super(scheduler, session, listener);
48+
if (!(session instanceof ClientHTTP3Session))
49+
throw new IllegalArgumentException("Invalid session: " + session);
4650
this.promise = promise;
4751
}
4852

49-
@Override
50-
public ClientHTTP3Session getProtocolSession()
53+
private ClientHTTP3Session getClientHTTP3Session()
5154
{
52-
return (ClientHTTP3Session)super.getProtocolSession();
55+
return (ClientHTTP3Session)getProtocolSession();
5356
}
5457

5558
@Override
@@ -61,7 +64,7 @@ public void onOpen()
6164
}
6265

6366
@Override
64-
protected HTTP3StreamClient newHTTP3Stream(StreamEndPoint endPoint, boolean local)
67+
protected HTTP3Stream newHTTP3Stream(StreamEndPoint endPoint, boolean local)
6568
{
6669
return new HTTP3StreamClient(this, endPoint, local);
6770
}
@@ -91,14 +94,14 @@ public void onSettings(SettingsFrame frame)
9194
{
9295
if (LOG.isDebugEnabled())
9396
LOG.debug("received {} on {}", frame, this);
94-
getProtocolSession().onSettings(frame);
97+
getClientHTTP3Session().onSettings(frame);
9598
super.onSettings(frame);
9699
}
97100

98101
@Override
99102
public void newRequest(HeadersFrame frame, Stream.Client.Listener listener, Promise.Invocable<Stream> promise)
100103
{
101-
ClientHTTP3Session protocolSession = getProtocolSession();
104+
ClientHTTP3Session protocolSession = getClientHTTP3Session();
102105
var quicSession = protocolSession.getSession();
103106
long streamId = quicSession.newStreamId(true);
104107
AtomicReference<StreamEndPoint> endPointRef = new AtomicReference<>();
@@ -139,7 +142,7 @@ public void succeeded(Stream result)
139142
public void failed(Throwable x)
140143
{
141144
stream.updateClose(frame.isLast(), true);
142-
Promise.Invocable<Stream> p = Promise.Invocable.from(getInvocationType(), s -> promise.failed(x), t -> promise.failed(x));
145+
Invocable<Stream> p = Invocable.from(getInvocationType(), s -> promise.failed(x), t -> promise.failed(x));
143146
stream.disconnect(HTTP3ErrorCode.REQUEST_CANCELLED_ERROR.code(), x, p);
144147
}
145148
});
@@ -148,13 +151,13 @@ public void failed(Throwable x)
148151
@Override
149152
public void writeControlFrame(Frame frame, Callback callback)
150153
{
151-
getProtocolSession().writeControlFrame(frame, callback);
154+
getClientHTTP3Session().writeControlFrame(frame, callback);
152155
}
153156

154157
@Override
155158
public void writeMessageFrame(StreamEndPoint streamEndPoint, Frame frame, Callback callback)
156159
{
157-
getProtocolSession().writeMessageFrame(streamEndPoint, frame, callback);
160+
getClientHTTP3Session().writeMessageFrame(streamEndPoint, frame, callback);
158161
}
159162

160163
@Override

jetty-core/jetty-http3/jetty-http3-tests/src/test/java/org/eclipse/jetty/http3/tests/ClientServerTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ public void onSettings(Session session, SettingsFrame frame)
149149
assertEquals(maxBlockedStreams.getValue(), serverSession.getProtocolSession().getQpackDecoder().getMaxBlockedStreams());
150150
assertEquals(maxHeaderSize.getValue(), serverSession.getProtocolSession().getQpackDecoder().getMaxHeadersSize());
151151

152-
assertEquals(maxTableCapacity.getValue(), clientSession.getProtocolSession().getQpackEncoder().getMaxTableCapacity());
153-
assertEquals(maxBlockedStreams.getValue(), clientSession.getProtocolSession().getQpackEncoder().getMaxBlockedStreams());
154-
assertEquals(maxBlockedStreams.getValue(), clientSession.getProtocolSession().getQpackDecoder().getMaxBlockedStreams());
155-
assertEquals(maxHeaderSize.getValue(), clientSession.getProtocolSession().getQpackDecoder().getMaxHeadersSize());
152+
assertEquals(maxTableCapacity.getValue(), ((ClientHTTP3Session)clientSession.getProtocolSession()).getQpackEncoder().getMaxTableCapacity());
153+
assertEquals(maxBlockedStreams.getValue(), ((ClientHTTP3Session)clientSession.getProtocolSession()).getQpackEncoder().getMaxBlockedStreams());
154+
assertEquals(maxBlockedStreams.getValue(), ((ClientHTTP3Session)clientSession.getProtocolSession()).getQpackDecoder().getMaxBlockedStreams());
155+
assertEquals(maxHeaderSize.getValue(), ((ClientHTTP3Session)clientSession.getProtocolSession()).getQpackDecoder().getMaxHeadersSize());
156156
}
157157

158158
@ParameterizedTest
@@ -206,7 +206,7 @@ public void onResponse(Stream.Client stream, HeadersFrame frame)
206206
assertTrue(serverProtocolSession.getStreamEndPoints().stream()
207207
.noneMatch(endPoint -> endPoint.getStream().getId() == stream.getId()));
208208

209-
ClientHTTP3Session clientProtocolSession = clientSession.getProtocolSession();
209+
ClientHTTP3Session clientProtocolSession = (ClientHTTP3Session)clientSession.getProtocolSession();
210210
assertTrue(clientProtocolSession.getStreamEndPoints().stream()
211211
.noneMatch(endPoint -> endPoint.getStream().getId() == stream.getId()));
212212
}
@@ -389,7 +389,7 @@ public void onDataAvailable(Stream.Client stream)
389389
assertTrue(serverProtocolSession.getStreamEndPoints().stream()
390390
.noneMatch(endPoint -> endPoint.getStream().getId() == stream.getId()));
391391

392-
ClientHTTP3Session clientProtocolSession = clientSession.getProtocolSession();
392+
ClientHTTP3Session clientProtocolSession = (ClientHTTP3Session)clientSession.getProtocolSession();
393393
assertTrue(clientProtocolSession.getStreamEndPoints().stream()
394394
.noneMatch(endPoint -> endPoint.getStream().getId() == stream.getId()));
395395
}

jetty-core/jetty-http3/jetty-http3-tests/src/test/java/org/eclipse/jetty/http3/tests/GoAwayTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ public void onResponse(Stream.Client stream, HeadersFrame frame)
133133

134134
assertTrue(clientSession.isClosed());
135135
assertTrue(clientSession.getStreams().isEmpty());
136-
ClientHTTP3Session clientProtocolSession = clientSession.getProtocolSession();
136+
ClientHTTP3Session clientProtocolSession = (ClientHTTP3Session)clientSession.getProtocolSession();
137137
// While HTTP/3 is completely closed, QUIC may still be exchanging packets, so we need to await().
138138
await().atMost(3, TimeUnit.SECONDS).until(() -> clientProtocolSession.getStreamEndPoints().isEmpty());
139139
await().atMost(3, TimeUnit.SECONDS).until(() -> clientProtocolSession.getSession().getStreams().isEmpty());
@@ -1035,7 +1035,7 @@ public void onFailure(Stream.Client stream, long error, Throwable failure)
10351035

10361036
assertTrue(clientSession.isClosed());
10371037
assertTrue(clientSession.getStreams().isEmpty());
1038-
ClientHTTP3Session clientProtocolSession = clientSession.getProtocolSession();
1038+
ClientHTTP3Session clientProtocolSession = (ClientHTTP3Session)clientSession.getProtocolSession();
10391039
// While HTTP/3 is completely closed, QUIC may still be exchanging packets, so we need to await().
10401040
await().atMost(1, TimeUnit.SECONDS).until(() -> clientProtocolSession.getStreamEndPoints().isEmpty());
10411041
await().atMost(3, TimeUnit.SECONDS).until(() -> clientProtocolSession.getSession().getStreams().isEmpty());

0 commit comments

Comments
 (0)