From 0555b0aefd93d2ddbf68f0163ec9751a5e80b3c8 Mon Sep 17 00:00:00 2001 From: Scott Mitchell Date: Thu, 8 Oct 2015 18:15:04 -0700 Subject: [PATCH] HTTP Headers Over Deprecation Motivation: As part of recent efforts to rectify performance and make 4.1 headers more similar to 5.0 some methods were deprecated. Some of these methods were deprecated because they used String instead of CharSequence in the signature, which may require casting at the user level. Some of the deprecated methods have no direct alternatives and were done to inform a user the method will go away in future releases. Modifications: - Remove the deprecated qualifier from methods where no direct replacement exists Result: Less warnings in user code. --- .../codec/http/DefaultHttpHeaders.java | 7 ---- .../netty/handler/codec/http/HttpHeaders.java | 32 +++++-------------- 2 files changed, 8 insertions(+), 31 deletions(-) diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpHeaders.java b/codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpHeaders.java index 7bce497def..fdea966c45 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpHeaders.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/DefaultHttpHeaders.java @@ -107,7 +107,6 @@ public class DefaultHttpHeaders extends HttpHeaders { } } - @Deprecated @Override public HttpHeaders add(String name, Object value) { headers.addObject(name, value); @@ -120,7 +119,6 @@ public class DefaultHttpHeaders extends HttpHeaders { return this; } - @Deprecated @Override public HttpHeaders add(String name, Iterable values) { headers.addObject(name, values); @@ -145,7 +143,6 @@ public class DefaultHttpHeaders extends HttpHeaders { return this; } - @Deprecated @Override public HttpHeaders remove(String name) { headers.remove(name); @@ -158,7 +155,6 @@ public class DefaultHttpHeaders extends HttpHeaders { return this; } - @Deprecated @Override public HttpHeaders set(String name, Object value) { headers.setObject(name, value); @@ -171,7 +167,6 @@ public class DefaultHttpHeaders extends HttpHeaders { return this; } - @Deprecated @Override public HttpHeaders set(String name, Iterable values) { headers.setObject(name, values); @@ -242,7 +237,6 @@ public class DefaultHttpHeaders extends HttpHeaders { return headers.getTimeMillis(name, defaultValue); } - @Deprecated @Override public List getAll(String name) { return getAll((CharSequence) name); @@ -253,7 +247,6 @@ public class DefaultHttpHeaders extends HttpHeaders { return HeadersUtils.getAllAsString(headers, name); } - @Deprecated @Override public List> entries() { if (isEmpty()) { diff --git a/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java b/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java index 305cada56d..b5e5252eb9 100644 --- a/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java +++ b/codec-http/src/main/java/io/netty/handler/codec/http/HttpHeaders.java @@ -532,8 +532,6 @@ public abstract class HttpHeaders implements Iterable> /** * @deprecated Use {@link #get(CharSequence)} instead. - * - * @see {@link #getHeader(HttpMessage, CharSequence)} */ @Deprecated public static String getHeader(HttpMessage message, String name) { @@ -1174,10 +1172,8 @@ public abstract class HttpHeaders implements Iterable> protected HttpHeaders() { } /** - * @deprecated Use {@link #get(CharSequence)} * @see #get(CharSequence) */ - @Deprecated public abstract String get(String name); /** @@ -1271,9 +1267,8 @@ public abstract class HttpHeaders implements Iterable> public abstract long getTimeMillis(CharSequence name, long defaultValue); /** - * @deprecated Use {@link #getAll(CharSequence)} + * @see #getAll(CharSequence) */ - @Deprecated public abstract List getAll(String name); /** @@ -1289,21 +1284,16 @@ public abstract class HttpHeaders implements Iterable> } /** - * @deprecated Use {@link #iteratorCharSequence()} - *

* Returns a new {@link List} that contains all headers in this object. Note that modifying the * returned {@link List} will not affect the state of this object. If you intend to enumerate over the header * entries only, use {@link #iterator()} instead, which has much less overhead. + * @see #iteratorCharSequence() */ - @Deprecated public abstract List> entries(); /** - * @deprecated Use {@link #contains(CharSequence)} - *

* @see {@link #contains(CharSequence)} */ - @Deprecated public abstract boolean contains(String name); /** @@ -1347,9 +1337,8 @@ public abstract class HttpHeaders implements Iterable> public abstract Set names(); /** - * @deprecated Use {@link #add(CharSequence, Object)} + * @see #add(CharSequence, Object) */ - @Deprecated public abstract HttpHeaders add(String name, Object value); /** @@ -1370,9 +1359,8 @@ public abstract class HttpHeaders implements Iterable> } /** - * @deprecated Use {@link #add(CharSequence, Iterable)} + * @see #add(CharSequence, Iterable) */ - @Deprecated public abstract HttpHeaders add(String name, Iterable values); /** @@ -1428,9 +1416,8 @@ public abstract class HttpHeaders implements Iterable> public abstract HttpHeaders addShort(CharSequence name, short value); /** - * @deprecated Use {@link #set(CharSequence, Object)} + * @see #set(CharSequence, Object) */ - @Deprecated public abstract HttpHeaders set(String name, Object value); /** @@ -1451,9 +1438,8 @@ public abstract class HttpHeaders implements Iterable> } /** - * @deprecated {@link #set(CharSequence, Iterable)} + * @see #set(CharSequence, Iterable) */ - @Deprecated public abstract HttpHeaders set(String name, Iterable values); /** @@ -1535,9 +1521,8 @@ public abstract class HttpHeaders implements Iterable> public abstract HttpHeaders setShort(CharSequence name, short value); /** - * @deprecated {@link #remove(CharSequence)} + * @see #remove(CharSequence) */ - @Deprecated public abstract HttpHeaders remove(String name); /** @@ -1558,9 +1543,8 @@ public abstract class HttpHeaders implements Iterable> public abstract HttpHeaders clear(); /** - * @deprecated Use {@link #contains(CharSequence, CharSequence, boolean)} + * @see #contains(CharSequence, CharSequence, boolean) */ - @Deprecated public boolean contains(String name, String value, boolean ignoreCase) { List values = getAll(name); if (values.isEmpty()) {