From 20042b65222ccfd83e0cda73959139839f3e3135 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Tue, 2 Apr 2019 20:52:06 +0200 Subject: [PATCH] Add @SupressWarnings("deprecation") to ChannelInboundHandlerAdapter and clarify deprecation in ChannelHandler (#9001) Motivation: https://github.com/netty/netty/pull/8826 added @Deprecated to the exceptionCaught(...) method but we missed to add @SupressWarnings(...) to it's sub-types. Beside this we can make the deprecated docs a bit more clear. Modifications: - Add @SupressWarnings("deprecated") - Clarify docs. Result: Less warnings and more clear deprecated docs. --- transport/src/main/java/io/netty/channel/ChannelHandler.java | 3 ++- .../java/io/netty/channel/ChannelInboundHandlerAdapter.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/transport/src/main/java/io/netty/channel/ChannelHandler.java b/transport/src/main/java/io/netty/channel/ChannelHandler.java index f9401080eb..3879056e43 100644 --- a/transport/src/main/java/io/netty/channel/ChannelHandler.java +++ b/transport/src/main/java/io/netty/channel/ChannelHandler.java @@ -191,7 +191,8 @@ public interface ChannelHandler { /** * Gets called if a {@link Throwable} was thrown. * - * @deprecated is part of {@link ChannelInboundHandler} + * @deprecated if you want to handle this event you should implement {@link ChannelInboundHandler} and + * implement the method there. */ @Deprecated void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception; diff --git a/transport/src/main/java/io/netty/channel/ChannelInboundHandlerAdapter.java b/transport/src/main/java/io/netty/channel/ChannelInboundHandlerAdapter.java index d0a1d2d766..c451329794 100644 --- a/transport/src/main/java/io/netty/channel/ChannelInboundHandlerAdapter.java +++ b/transport/src/main/java/io/netty/channel/ChannelInboundHandlerAdapter.java @@ -126,6 +126,7 @@ public class ChannelInboundHandlerAdapter extends ChannelHandlerAdapter implemen * Sub-classes may override this method to change behavior. */ @Override + @SuppressWarnings("deprecation") public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { ctx.fireExceptionCaught(cause);