Remove redundant modifiers.

- All methods in a final class are already final.
- All members of an interface are public.
- All inner enums are static.
This commit is contained in:
Gary Gregory 2020-11-23 11:43:24 -05:00 committed by Gary Gregory
parent 956b8194ff
commit 712148ecc3
3 changed files with 35 additions and 35 deletions

View File

@ -188,26 +188,26 @@ public final class HttpRoute implements RouteInfo, Cloneable {
} }
@Override @Override
public final HttpHost getTargetHost() { public HttpHost getTargetHost() {
return this.targetHost; return this.targetHost;
} }
@Override @Override
public final InetAddress getLocalAddress() { public InetAddress getLocalAddress() {
return this.localAddress; return this.localAddress;
} }
public final InetSocketAddress getLocalSocketAddress() { public InetSocketAddress getLocalSocketAddress() {
return this.localAddress != null ? new InetSocketAddress(this.localAddress, 0) : null; return this.localAddress != null ? new InetSocketAddress(this.localAddress, 0) : null;
} }
@Override @Override
public final int getHopCount() { public int getHopCount() {
return proxyChain != null ? proxyChain.size() + 1 : 1; return proxyChain != null ? proxyChain.size() + 1 : 1;
} }
@Override @Override
public final HttpHost getHopTarget(final int hop) { public HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index"); Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount(); final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length"); Args.check(hop < hopcount, "Hop index exceeds tracked route length");
@ -218,32 +218,32 @@ public final class HttpRoute implements RouteInfo, Cloneable {
} }
@Override @Override
public final HttpHost getProxyHost() { public HttpHost getProxyHost() {
return proxyChain != null && !this.proxyChain.isEmpty() ? this.proxyChain.get(0) : null; return proxyChain != null && !this.proxyChain.isEmpty() ? this.proxyChain.get(0) : null;
} }
@Override @Override
public final TunnelType getTunnelType() { public TunnelType getTunnelType() {
return this.tunnelled; return this.tunnelled;
} }
@Override @Override
public final boolean isTunnelled() { public boolean isTunnelled() {
return (this.tunnelled == TunnelType.TUNNELLED); return (this.tunnelled == TunnelType.TUNNELLED);
} }
@Override @Override
public final LayerType getLayerType() { public LayerType getLayerType() {
return this.layered; return this.layered;
} }
@Override @Override
public final boolean isLayered() { public boolean isLayered() {
return (this.layered == LayerType.LAYERED); return (this.layered == LayerType.LAYERED);
} }
@Override @Override
public final boolean isSecure() { public boolean isSecure() {
return this.secure; return this.secure;
} }
@ -256,7 +256,7 @@ public final class HttpRoute implements RouteInfo, Cloneable {
* {@code false} * {@code false}
*/ */
@Override @Override
public final boolean equals(final Object obj) { public boolean equals(final Object obj) {
if (this == obj) { if (this == obj) {
return true; return true;
} }
@ -281,7 +281,7 @@ public final class HttpRoute implements RouteInfo, Cloneable {
* @return the hash code * @return the hash code
*/ */
@Override @Override
public final int hashCode() { public int hashCode() {
int hash = LangUtils.HASH_SEED; int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.targetHost); hash = LangUtils.hashCode(hash, this.targetHost);
hash = LangUtils.hashCode(hash, this.localAddress); hash = LangUtils.hashCode(hash, this.localAddress);
@ -302,7 +302,7 @@ public final class HttpRoute implements RouteInfo, Cloneable {
* @return a human-readable representation of this route * @return a human-readable representation of this route
*/ */
@Override @Override
public final String toString() { public String toString() {
final StringBuilder cab = new StringBuilder(50 + getHopCount()*30); final StringBuilder cab = new StringBuilder(50 + getHopCount()*30);
if (this.localAddress != null) { if (this.localAddress != null) {
cab.append(this.localAddress); cab.append(this.localAddress);

View File

@ -112,7 +112,7 @@ public final class RouteTracker implements RouteInfo, Cloneable {
* @param secure {@code true} if the route is secure, * @param secure {@code true} if the route is secure,
* {@code false} otherwise * {@code false} otherwise
*/ */
public final void connectTarget(final boolean secure) { public void connectTarget(final boolean secure) {
Asserts.check(!this.connected, "Already connected"); Asserts.check(!this.connected, "Already connected");
this.connected = true; this.connected = true;
this.secure = secure; this.secure = secure;
@ -125,7 +125,7 @@ public final class RouteTracker implements RouteInfo, Cloneable {
* @param secure {@code true} if the route is secure, * @param secure {@code true} if the route is secure,
* {@code false} otherwise * {@code false} otherwise
*/ */
public final void connectProxy(final HttpHost proxy, final boolean secure) { public void connectProxy(final HttpHost proxy, final boolean secure) {
Args.notNull(proxy, "Proxy host"); Args.notNull(proxy, "Proxy host");
Asserts.check(!this.connected, "Already connected"); Asserts.check(!this.connected, "Already connected");
this.connected = true; this.connected = true;
@ -139,7 +139,7 @@ public final class RouteTracker implements RouteInfo, Cloneable {
* @param secure {@code true} if the route is secure, * @param secure {@code true} if the route is secure,
* {@code false} otherwise * {@code false} otherwise
*/ */
public final void tunnelTarget(final boolean secure) { public void tunnelTarget(final boolean secure) {
Asserts.check(this.connected, "No tunnel unless connected"); Asserts.check(this.connected, "No tunnel unless connected");
Asserts.notNull(this.proxyChain, "No tunnel without proxy"); Asserts.notNull(this.proxyChain, "No tunnel without proxy");
this.tunnelled = TunnelType.TUNNELLED; this.tunnelled = TunnelType.TUNNELLED;
@ -155,7 +155,7 @@ public final class RouteTracker implements RouteInfo, Cloneable {
* @param secure {@code true} if the route is secure, * @param secure {@code true} if the route is secure,
* {@code false} otherwise * {@code false} otherwise
*/ */
public final void tunnelProxy(final HttpHost proxy, final boolean secure) { public void tunnelProxy(final HttpHost proxy, final boolean secure) {
Args.notNull(proxy, "Proxy host"); Args.notNull(proxy, "Proxy host");
Asserts.check(this.connected, "No tunnel unless connected"); Asserts.check(this.connected, "No tunnel unless connected");
Asserts.notNull(this.proxyChain, "No tunnel without proxy"); Asserts.notNull(this.proxyChain, "No tunnel without proxy");
@ -175,7 +175,7 @@ public final class RouteTracker implements RouteInfo, Cloneable {
* @param secure {@code true} if the route is secure, * @param secure {@code true} if the route is secure,
* {@code false} otherwise * {@code false} otherwise
*/ */
public final void layerProtocol(final boolean secure) { public void layerProtocol(final boolean secure) {
// it is possible to layer a protocol over a direct connection, // it is possible to layer a protocol over a direct connection,
// although this case is probably not considered elsewhere // although this case is probably not considered elsewhere
Asserts.check(this.connected, "No layered protocol unless connected"); Asserts.check(this.connected, "No layered protocol unless connected");
@ -184,17 +184,17 @@ public final class RouteTracker implements RouteInfo, Cloneable {
} }
@Override @Override
public final HttpHost getTargetHost() { public HttpHost getTargetHost() {
return this.targetHost; return this.targetHost;
} }
@Override @Override
public final InetAddress getLocalAddress() { public InetAddress getLocalAddress() {
return this.localAddress; return this.localAddress;
} }
@Override @Override
public final int getHopCount() { public int getHopCount() {
int hops = 0; int hops = 0;
if (this.connected) { if (this.connected) {
if (proxyChain == null) { if (proxyChain == null) {
@ -207,7 +207,7 @@ public final class RouteTracker implements RouteInfo, Cloneable {
} }
@Override @Override
public final HttpHost getHopTarget(final int hop) { public HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index"); Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount(); final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length"); Args.check(hop < hopcount, "Hop index exceeds tracked route length");
@ -222,36 +222,36 @@ public final class RouteTracker implements RouteInfo, Cloneable {
} }
@Override @Override
public final HttpHost getProxyHost() { public HttpHost getProxyHost() {
return (this.proxyChain == null) ? null : this.proxyChain[0]; return (this.proxyChain == null) ? null : this.proxyChain[0];
} }
public final boolean isConnected() { public boolean isConnected() {
return this.connected; return this.connected;
} }
@Override @Override
public final TunnelType getTunnelType() { public TunnelType getTunnelType() {
return this.tunnelled; return this.tunnelled;
} }
@Override @Override
public final boolean isTunnelled() { public boolean isTunnelled() {
return (this.tunnelled == TunnelType.TUNNELLED); return (this.tunnelled == TunnelType.TUNNELLED);
} }
@Override @Override
public final LayerType getLayerType() { public LayerType getLayerType() {
return this.layered; return this.layered;
} }
@Override @Override
public final boolean isLayered() { public boolean isLayered() {
return (this.layered == LayerType.LAYERED); return (this.layered == LayerType.LAYERED);
} }
@Override @Override
public final boolean isSecure() { public boolean isSecure() {
return this.secure; return this.secure;
} }
@ -263,7 +263,7 @@ public final class RouteTracker implements RouteInfo, Cloneable {
* @return the tracked route, or * @return the tracked route, or
* {@code null} if nothing has been tracked so far * {@code null} if nothing has been tracked so far
*/ */
public final HttpRoute toRoute() { public HttpRoute toRoute() {
return !this.connected ? return !this.connected ?
null : new HttpRoute(this.targetHost, this.localAddress, null : new HttpRoute(this.targetHost, this.localAddress,
this.proxyChain, this.secure, this.proxyChain, this.secure,
@ -279,7 +279,7 @@ public final class RouteTracker implements RouteInfo, Cloneable {
* {@code false} * {@code false}
*/ */
@Override @Override
public final boolean equals(final Object o) { public boolean equals(final Object o) {
if (o == this) { if (o == this) {
return true; return true;
} }
@ -308,7 +308,7 @@ public final class RouteTracker implements RouteInfo, Cloneable {
* @return the hash code * @return the hash code
*/ */
@Override @Override
public final int hashCode() { public int hashCode() {
int hash = LangUtils.HASH_SEED; int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.targetHost); hash = LangUtils.hashCode(hash, this.targetHost);
hash = LangUtils.hashCode(hash, this.localAddress); hash = LangUtils.hashCode(hash, this.localAddress);
@ -330,7 +330,7 @@ public final class RouteTracker implements RouteInfo, Cloneable {
* @return a human-readable representation of the tracked route * @return a human-readable representation of the tracked route
*/ */
@Override @Override
public final String toString() { public String toString() {
final StringBuilder cab = new StringBuilder(50 + getHopCount()*30); final StringBuilder cab = new StringBuilder(50 + getHopCount()*30);
cab.append("RouteTracker["); cab.append("RouteTracker[");

View File

@ -201,7 +201,7 @@ public final class MinimalHttpAsyncClient extends AbstractMinimalHttpAsyncClient
return resultFuture; return resultFuture;
} }
public final Future<AsyncClientEndpoint> lease( public Future<AsyncClientEndpoint> lease(
final HttpHost host, final HttpHost host,
final FutureCallback<AsyncClientEndpoint> callback) { final FutureCallback<AsyncClientEndpoint> callback) {
return lease(host, HttpClientContext.create(), callback); return lease(host, HttpClientContext.create(), callback);