From 4010769051db4b233e2d70df2dd7da6c403c6212 Mon Sep 17 00:00:00 2001 From: Idel Pivnitskiy Date: Mon, 3 May 2021 22:32:16 -0700 Subject: [PATCH] Decrease visibility of `Http2FrameCodecBuilder` default ctor to `protected` (#11220) Motivation: `Http2FrameCodecBuilder` defines static factory methods `forClient()` and `forServer()` that should be used to create a new instance. The default ctor is useful only when users need to override behavior of the existing builder. Those users should define another way to create an instance. Modifications: - Decrease visibility of `Http2FrameCodecBuilder` default ctor from `public` to `protected`; - Add javadoc to clarity responsibilities; Result: Users of `Http2FrameCodecBuilder` are not confused why `new Http2FrameCodecBuilder().build()` works for the server-side, but does not work for the client-side. --- .../handler/codec/http2/Http2FrameCodecBuilder.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodecBuilder.java b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodecBuilder.java index 3a5a43f72a..59f43d8db5 100644 --- a/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodecBuilder.java +++ b/codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameCodecBuilder.java @@ -29,7 +29,16 @@ public class Http2FrameCodecBuilder extends private Http2FrameWriter frameWriter; - public Http2FrameCodecBuilder() { + /** + * Allows overriding behavior of existing builder. + *

+ * Users of this constructor are responsible for invoking {@link #server(boolean)} method or overriding + * {@link #isServer()} method to give the builder information if the {@link Http2Connection}(s) it creates are in + * server or client mode. + * + * @see AbstractHttp2ConnectionHandlerBuilder + */ + protected Http2FrameCodecBuilder() { } Http2FrameCodecBuilder(boolean server) {