From e715c0a6fe1238eee4b5d9f9c4012f795cb0810f Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Fri, 19 Feb 2021 11:37:29 +0100 Subject: [PATCH] Override the flush() and read() methods to return the correct Channel subtype (#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 --- .../io/netty/incubator/codec/quic/QuicChannel.java | 6 ++++++ .../incubator/codec/quic/QuicStreamChannel.java | 7 +++++++ .../incubator/codec/quic/QuicheQuicChannel.java | 12 ++++++++++++ .../codec/quic/QuicheQuicStreamChannel.java | 12 ++++++++++++ 4 files changed, 37 insertions(+) diff --git a/src/main/java/io/netty/incubator/codec/quic/QuicChannel.java b/src/main/java/io/netty/incubator/codec/quic/QuicChannel.java index 2ccc624d6..291592e50 100644 --- a/src/main/java/io/netty/incubator/codec/quic/QuicChannel.java +++ b/src/main/java/io/netty/incubator/codec/quic/QuicChannel.java @@ -28,6 +28,12 @@ */ public interface QuicChannel extends Channel { + @Override + QuicChannel read(); + + @Override + QuicChannel flush(); + /** * Returns the configuration of this channel. */ diff --git a/src/main/java/io/netty/incubator/codec/quic/QuicStreamChannel.java b/src/main/java/io/netty/incubator/codec/quic/QuicStreamChannel.java index 501340340..d1fdc4b1d 100644 --- a/src/main/java/io/netty/incubator/codec/quic/QuicStreamChannel.java +++ b/src/main/java/io/netty/incubator/codec/quic/QuicStreamChannel.java @@ -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; @@ -90,6 +91,12 @@ default ChannelFuture updatePriority(QuicStreamPriority priority) { @Override QuicChannel parent(); + @Override + QuicStreamChannel read(); + + @Override + QuicStreamChannel flush(); + @Override QuicStreamChannelConfig config(); } diff --git a/src/main/java/io/netty/incubator/codec/quic/QuicheQuicChannel.java b/src/main/java/io/netty/incubator/codec/quic/QuicheQuicChannel.java index 04ff2ab02..7740d5819 100644 --- a/src/main/java/io/netty/incubator/codec/quic/QuicheQuicChannel.java +++ b/src/main/java/io/netty/incubator/codec/quic/QuicheQuicChannel.java @@ -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 createStream(QuicStreamType type, ChannelHandler handler, Promise promise) { diff --git a/src/main/java/io/netty/incubator/codec/quic/QuicheQuicStreamChannel.java b/src/main/java/io/netty/incubator/codec/quic/QuicheQuicStreamChannel.java index 7add0d500..a3869e9cd 100644 --- a/src/main/java/io/netty/incubator/codec/quic/QuicheQuicStreamChannel.java +++ b/src/main/java/io/netty/incubator/codec/quic/QuicheQuicStreamChannel.java @@ -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;