Skip to content
Permalink
Browse files
Remove redundant modifiers.
- All methods in a final class are already final.
- All members of an interface are public.
- All inner enums are static.
  • Loading branch information
garydgregory committed Nov 24, 2020
1 parent 956b819 commit 712148ecc3cc088e1d674dd8ffaf45845b3d2e95
Showing 3 changed files with 35 additions and 35 deletions.
@@ -188,26 +188,26 @@ public HttpRoute(final HttpHost target, final HttpHost proxy) {
}

@Override
public final HttpHost getTargetHost() {
public HttpHost getTargetHost() {
return this.targetHost;
}

@Override
public final InetAddress getLocalAddress() {
public InetAddress getLocalAddress() {
return this.localAddress;
}

public final InetSocketAddress getLocalSocketAddress() {
public InetSocketAddress getLocalSocketAddress() {
return this.localAddress != null ? new InetSocketAddress(this.localAddress, 0) : null;
}

@Override
public final int getHopCount() {
public int getHopCount() {
return proxyChain != null ? proxyChain.size() + 1 : 1;
}

@Override
public final HttpHost getHopTarget(final int hop) {
public HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
@@ -218,32 +218,32 @@ public final HttpHost getHopTarget(final int hop) {
}

@Override
public final HttpHost getProxyHost() {
public HttpHost getProxyHost() {
return proxyChain != null && !this.proxyChain.isEmpty() ? this.proxyChain.get(0) : null;
}

@Override
public final TunnelType getTunnelType() {
public TunnelType getTunnelType() {
return this.tunnelled;
}

@Override
public final boolean isTunnelled() {
public boolean isTunnelled() {
return (this.tunnelled == TunnelType.TUNNELLED);
}

@Override
public final LayerType getLayerType() {
public LayerType getLayerType() {
return this.layered;
}

@Override
public final boolean isLayered() {
public boolean isLayered() {
return (this.layered == LayerType.LAYERED);
}

@Override
public final boolean isSecure() {
public boolean isSecure() {
return this.secure;
}

@@ -256,7 +256,7 @@ public final boolean isSecure() {
* {@code false}
*/
@Override
public final boolean equals(final Object obj) {
public boolean equals(final Object obj) {
if (this == obj) {
return true;
}
@@ -281,7 +281,7 @@ public final boolean equals(final Object obj) {
* @return the hash code
*/
@Override
public final int hashCode() {
public int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.targetHost);
hash = LangUtils.hashCode(hash, this.localAddress);
@@ -302,7 +302,7 @@ public final int hashCode() {
* @return a human-readable representation of this route
*/
@Override
public final String toString() {
public String toString() {
final StringBuilder cab = new StringBuilder(50 + getHopCount()*30);
if (this.localAddress != null) {
cab.append(this.localAddress);
@@ -112,7 +112,7 @@ public RouteTracker(final HttpRoute route) {
* @param secure {@code true} if the route is secure,
* {@code false} otherwise
*/
public final void connectTarget(final boolean secure) {
public void connectTarget(final boolean secure) {
Asserts.check(!this.connected, "Already connected");
this.connected = true;
this.secure = secure;
@@ -125,7 +125,7 @@ public final void connectTarget(final boolean secure) {
* @param secure {@code true} if the route is secure,
* {@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");
Asserts.check(!this.connected, "Already connected");
this.connected = true;
@@ -139,7 +139,7 @@ public final void connectProxy(final HttpHost proxy, final boolean secure) {
* @param secure {@code true} if the route is secure,
* {@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.notNull(this.proxyChain, "No tunnel without proxy");
this.tunnelled = TunnelType.TUNNELLED;
@@ -155,7 +155,7 @@ public final void tunnelTarget(final boolean secure) {
* @param secure {@code true} if the route is secure,
* {@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");
Asserts.check(this.connected, "No tunnel unless connected");
Asserts.notNull(this.proxyChain, "No tunnel without proxy");
@@ -175,7 +175,7 @@ public final void tunnelProxy(final HttpHost proxy, final boolean secure) {
* @param secure {@code true} if the route is secure,
* {@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,
// although this case is probably not considered elsewhere
Asserts.check(this.connected, "No layered protocol unless connected");
@@ -184,17 +184,17 @@ public final void layerProtocol(final boolean secure) {
}

@Override
public final HttpHost getTargetHost() {
public HttpHost getTargetHost() {
return this.targetHost;
}

@Override
public final InetAddress getLocalAddress() {
public InetAddress getLocalAddress() {
return this.localAddress;
}

@Override
public final int getHopCount() {
public int getHopCount() {
int hops = 0;
if (this.connected) {
if (proxyChain == null) {
@@ -207,7 +207,7 @@ public final int getHopCount() {
}

@Override
public final HttpHost getHopTarget(final int hop) {
public HttpHost getHopTarget(final int hop) {
Args.notNegative(hop, "Hop index");
final int hopcount = getHopCount();
Args.check(hop < hopcount, "Hop index exceeds tracked route length");
@@ -222,36 +222,36 @@ public final HttpHost getHopTarget(final int hop) {
}

@Override
public final HttpHost getProxyHost() {
public HttpHost getProxyHost() {
return (this.proxyChain == null) ? null : this.proxyChain[0];
}

public final boolean isConnected() {
public boolean isConnected() {
return this.connected;
}

@Override
public final TunnelType getTunnelType() {
public TunnelType getTunnelType() {
return this.tunnelled;
}

@Override
public final boolean isTunnelled() {
public boolean isTunnelled() {
return (this.tunnelled == TunnelType.TUNNELLED);
}

@Override
public final LayerType getLayerType() {
public LayerType getLayerType() {
return this.layered;
}

@Override
public final boolean isLayered() {
public boolean isLayered() {
return (this.layered == LayerType.LAYERED);
}

@Override
public final boolean isSecure() {
public boolean isSecure() {
return this.secure;
}

@@ -263,7 +263,7 @@ public final boolean isSecure() {
* @return the tracked route, or
* {@code null} if nothing has been tracked so far
*/
public final HttpRoute toRoute() {
public HttpRoute toRoute() {
return !this.connected ?
null : new HttpRoute(this.targetHost, this.localAddress,
this.proxyChain, this.secure,
@@ -279,7 +279,7 @@ public final HttpRoute toRoute() {
* {@code false}
*/
@Override
public final boolean equals(final Object o) {
public boolean equals(final Object o) {
if (o == this) {
return true;
}
@@ -308,7 +308,7 @@ public final boolean equals(final Object o) {
* @return the hash code
*/
@Override
public final int hashCode() {
public int hashCode() {
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.targetHost);
hash = LangUtils.hashCode(hash, this.localAddress);
@@ -330,7 +330,7 @@ public final int hashCode() {
* @return a human-readable representation of the tracked route
*/
@Override
public final String toString() {
public String toString() {
final StringBuilder cab = new StringBuilder(50 + getHopCount()*30);

cab.append("RouteTracker[");
@@ -201,7 +201,7 @@ public void cancelled() {
return resultFuture;
}

public final Future<AsyncClientEndpoint> lease(
public Future<AsyncClientEndpoint> lease(
final HttpHost host,
final FutureCallback<AsyncClientEndpoint> callback) {
return lease(host, HttpClientContext.create(), callback);

0 comments on commit 712148e

Please sign in to comment.