Skip to content

Commit

Permalink
Override the flush() and read() methods to return the correct Channel…
Browse files Browse the repository at this point in the history
… subtype (java-native-access#192)

Motivation:

We should override the flush / read method so we return the correct sub-type for method chaining.

Modifications:

Add missing overrides and implementations

Result:

Be able to correctly method chain
  • Loading branch information
normanmaurer authored Feb 19, 2021
1 parent ca35974 commit e715c0a
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/io/netty/incubator/codec/quic/QuicChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
*/
public interface QuicChannel extends Channel {

@Override
QuicChannel read();

@Override
QuicChannel flush();

/**
* Returns the configuration of this channel.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package io.netty.incubator.codec.quic;

import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import io.netty.channel.ChannelFutureListener;
import io.netty.channel.ChannelPromise;
Expand Down Expand Up @@ -90,6 +91,12 @@ default ChannelFuture updatePriority(QuicStreamPriority priority) {
@Override
QuicChannel parent();

@Override
QuicStreamChannel read();

@Override
QuicStreamChannel flush();

@Override
QuicStreamChannelConfig config();
}
12 changes: 12 additions & 0 deletions src/main/java/io/netty/incubator/codec/quic/QuicheQuicChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,18 @@ protected void onUnhandledInboundMessage(ChannelHandlerContext ctx, Object msg)
};
}

@Override
public QuicChannel flush() {
super.flush();
return this;
}

@Override
public QuicChannel read() {
super.read();
return this;
}

@Override
public Future<QuicStreamChannel> createStream(QuicStreamType type, ChannelHandler handler,
Promise<QuicStreamChannel> promise) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,18 @@ private void removeStreamFromParent() {
}
}

@Override
public QuicStreamChannel flush() {
super.flush();
return this;
}

@Override
public QuicStreamChannel read() {
super.read();
return this;
}

@Override
public QuicStreamChannelConfig config() {
return config;
Expand Down

0 comments on commit e715c0a

Please sign in to comment.