From 4b84ed5908f225396016f580598145b2809cc2ac Mon Sep 17 00:00:00 2001 From: Justin Guerra Date: Thu, 14 Sep 2023 15:47:04 -0600 Subject: [PATCH] Add missing overrides --- build.gradle | 3 +++ .../netty/common/CategorizedThreadFactory.java | 1 + .../netty/common/http2/DynamicHttp2FrameLogger.java | 13 +++++++++++++ .../java/com/netflix/zuul/FilterFileManager.java | 1 + .../java/com/netflix/zuul/message/ZuulMessage.java | 1 + .../netflix/zuul/message/http/HttpRequestInfo.java | 3 +++ .../zuul/message/http/HttpRequestMessage.java | 1 + .../DefaultOriginChannelInitializer.java | 1 + .../java/com/netflix/zuul/netty/server/Server.java | 1 + .../zuul/netty/ssl/BaseSslContextFactory.java | 2 ++ .../com/netflix/zuul/origins/BasicNettyOrigin.java | 1 + .../netflix/zuul/stats/NamedCountingMonitor.java | 1 + .../netflix/zuul/stats/RouteStatusCodeMonitor.java | 1 + .../java/com/netflix/zuul/util/JsonUtility.java | 1 + .../com/netflix/zuul/groovy/GroovyCompiler.java | 2 ++ .../com/netflix/zuul/groovy/GroovyFileFilter.java | 1 + .../integration/server/FilterLoaderProvider.java | 1 + 17 files changed, 35 insertions(+) diff --git a/build.gradle b/build.gradle index 4c60b284c7..668914ae62 100644 --- a/build.gradle +++ b/build.gradle @@ -93,6 +93,7 @@ subprojects { dependencies { rewrite(platform("org.openrewrite.recipe:rewrite-recipe-bom:2.2.1")) + rewrite("org.openrewrite.recipe:rewrite-static-analysis:1.0.7") rewrite("org.openrewrite.recipe:rewrite-logging-frameworks") rewrite("org.openrewrite.recipe:rewrite-testing-frameworks") } @@ -102,6 +103,8 @@ rewrite { activeRecipe("org.openrewrite.java.testing.junit5.JUnit5BestPractices") activeRecipe("org.openrewrite.java.logging.slf4j.Slf4jBestPractices") //activeRecipe("org.openrewrite.staticanalysis.NeedBraces") +// activeRecipe("org.openrewrite.staticanalysis.MissingOverrideAnnotation") + exclusion( // Exclude all groovy files "**/*.groovy") diff --git a/zuul-core/src/main/java/com/netflix/netty/common/CategorizedThreadFactory.java b/zuul-core/src/main/java/com/netflix/netty/common/CategorizedThreadFactory.java index 727fc68a85..fb761b7c26 100644 --- a/zuul-core/src/main/java/com/netflix/netty/common/CategorizedThreadFactory.java +++ b/zuul-core/src/main/java/com/netflix/netty/common/CategorizedThreadFactory.java @@ -34,6 +34,7 @@ public CategorizedThreadFactory(String category) { this.category = category; } + @Override public Thread newThread(final Runnable r) { final FastThreadLocalThread t = new FastThreadLocalThread(r, category + "-" + num++); return t; diff --git a/zuul-core/src/main/java/com/netflix/netty/common/http2/DynamicHttp2FrameLogger.java b/zuul-core/src/main/java/com/netflix/netty/common/http2/DynamicHttp2FrameLogger.java index f48b3ae41e..27d9524ded 100644 --- a/zuul-core/src/main/java/com/netflix/netty/common/http2/DynamicHttp2FrameLogger.java +++ b/zuul-core/src/main/java/com/netflix/netty/common/http2/DynamicHttp2FrameLogger.java @@ -56,6 +56,7 @@ protected boolean enabled() { return logger.isEnabled(level); } + @Override public void logData( Direction direction, ChannelHandlerContext ctx, @@ -75,6 +76,7 @@ public void logData( } } + @Override public void logHeaders( Direction direction, ChannelHandlerContext ctx, @@ -87,6 +89,7 @@ public void logHeaders( } } + @Override public void logHeaders( Direction direction, ChannelHandlerContext ctx, @@ -112,6 +115,7 @@ public void logHeaders( } } + @Override public void logPriority( Direction direction, ChannelHandlerContext ctx, @@ -132,36 +136,42 @@ public void logPriority( } } + @Override public void logRstStream(Direction direction, ChannelHandlerContext ctx, int streamId, long errorCode) { if (enabled()) { log(direction, "RST_STREAM", ctx, "streamId=%d, errorCode=%d", streamId, errorCode); } } + @Override public void logSettingsAck(Direction direction, ChannelHandlerContext ctx) { if (enabled()) { log(direction, "SETTINGS", ctx, "ack=true"); } } + @Override public void logSettings(Direction direction, ChannelHandlerContext ctx, Http2Settings settings) { if (enabled()) { log(direction, "SETTINGS", ctx, "ack=false, settings=%s", settings); } } + @Override public void logPing(Direction direction, ChannelHandlerContext ctx, long data) { if (enabled()) { log(direction, "PING", ctx, "ack=false, length=%d", data); } } + @Override public void logPingAck(Direction direction, ChannelHandlerContext ctx, long data) { if (enabled()) { log(direction, "PING", ctx, "ack=true, length=%d", data); } } + @Override public void logPushPromise( Direction direction, ChannelHandlerContext ctx, @@ -182,6 +192,7 @@ public void logPushPromise( } } + @Override public void logGoAway( Direction direction, ChannelHandlerContext ctx, int lastStreamId, long errorCode, ByteBuf debugData) { if (enabled()) { @@ -197,6 +208,7 @@ public void logGoAway( } } + @Override public void logWindowsUpdate( Direction direction, ChannelHandlerContext ctx, int streamId, int windowSizeIncrement) { if (enabled()) { @@ -204,6 +216,7 @@ public void logWindowsUpdate( } } + @Override public void logUnknownFrame( Direction direction, ChannelHandlerContext ctx, diff --git a/zuul-core/src/main/java/com/netflix/zuul/FilterFileManager.java b/zuul-core/src/main/java/com/netflix/zuul/FilterFileManager.java index 163b4a2528..77b9d0babb 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/FilterFileManager.java +++ b/zuul-core/src/main/java/com/netflix/zuul/FilterFileManager.java @@ -108,6 +108,7 @@ void startPoller() { setDaemon(true); } + @Override public void run() { while (bRunning) { try { diff --git a/zuul-core/src/main/java/com/netflix/zuul/message/ZuulMessage.java b/zuul-core/src/main/java/com/netflix/zuul/message/ZuulMessage.java index 017cbcfe83..03d48e4114 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/message/ZuulMessage.java +++ b/zuul-core/src/main/java/com/netflix/zuul/message/ZuulMessage.java @@ -141,6 +141,7 @@ public interface ZuulMessage extends Cloneable { /** * Returns a copy of this message. */ + @Override ZuulMessage clone(); /** diff --git a/zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestInfo.java b/zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestInfo.java index f0770cf424..12cfcde83d 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestInfo.java +++ b/zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestInfo.java @@ -37,6 +37,7 @@ public interface HttpRequestInfo extends ZuulMessage { String getPathAndQuery(); + @Override Headers getHeaders(); String getClientIp(); @@ -47,8 +48,10 @@ public interface HttpRequestInfo extends ZuulMessage { String getServerName(); + @Override int getMaxBodySize(); + @Override String getInfoForLogging(); String getOriginalHost(); diff --git a/zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestMessage.java b/zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestMessage.java index a8e0ba083e..6d3bfafdf9 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestMessage.java +++ b/zuul-core/src/main/java/com/netflix/zuul/message/http/HttpRequestMessage.java @@ -34,6 +34,7 @@ public interface HttpRequestMessage extends HttpRequestInfo { void setServerName(String serverName); + @Override ZuulMessage clone(); void storeInboundRequest(); diff --git a/zuul-core/src/main/java/com/netflix/zuul/netty/connectionpool/DefaultOriginChannelInitializer.java b/zuul-core/src/main/java/com/netflix/zuul/netty/connectionpool/DefaultOriginChannelInitializer.java index 6ad3fc075a..7424139bef 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/netty/connectionpool/DefaultOriginChannelInitializer.java +++ b/zuul-core/src/main/java/com/netflix/zuul/netty/connectionpool/DefaultOriginChannelInitializer.java @@ -108,6 +108,7 @@ protected SslContext getClientSslContext(Registry spectatorRegistry) { */ protected void addMethodBindingHandler(ChannelPipeline pipeline) {} + @Override public HttpMetricsChannelHandler getHttpMetricsHandler() { return httpMetricsHandler; } diff --git a/zuul-core/src/main/java/com/netflix/zuul/netty/server/Server.java b/zuul-core/src/main/java/com/netflix/zuul/netty/server/Server.java index f1c36ef716..675db44d06 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/netty/server/Server.java +++ b/zuul-core/src/main/java/com/netflix/zuul/netty/server/Server.java @@ -358,6 +358,7 @@ private ServerGroup( this.eventLoopGroupMetrics = eventLoopGroupMetrics; Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { + @Override public void uncaughtException(final Thread t, final Throwable e) { LOG.error("Uncaught throwable", e); } diff --git a/zuul-core/src/main/java/com/netflix/zuul/netty/ssl/BaseSslContextFactory.java b/zuul-core/src/main/java/com/netflix/zuul/netty/ssl/BaseSslContextFactory.java index c72c6e99d4..4277b88e80 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/netty/ssl/BaseSslContextFactory.java +++ b/zuul-core/src/main/java/com/netflix/zuul/netty/ssl/BaseSslContextFactory.java @@ -116,6 +116,7 @@ public void enableSessionTickets(SslContext sslContext) { // TODO } + @Override public void configureOpenSslStatsMetrics(SslContext sslContext, String sslContextId) { // Setup metrics tracking the OpenSSL stats. if (sslContext instanceof ReferenceCountedOpenSslContext) { @@ -172,6 +173,7 @@ public String[] getProtocols() { return serverSslConfig.getProtocols(); } + @Override public List getCiphers() throws NoSuchAlgorithmException { return serverSslConfig.getCiphers(); } diff --git a/zuul-core/src/main/java/com/netflix/zuul/origins/BasicNettyOrigin.java b/zuul-core/src/main/java/com/netflix/zuul/origins/BasicNettyOrigin.java index 60f83de8a8..340282f178 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/origins/BasicNettyOrigin.java +++ b/zuul-core/src/main/java/com/netflix/zuul/origins/BasicNettyOrigin.java @@ -124,6 +124,7 @@ public Promise connectToOrigin( return clientChannelManager.acquire(eventLoop, null, passport, chosenServer, chosenHostAddr); } + @Override public int getMaxRetriesForRequest(SessionContext context) { return config.get(CommonClientConfigKey.MaxAutoRetriesNextServer, 0); } diff --git a/zuul-core/src/main/java/com/netflix/zuul/stats/NamedCountingMonitor.java b/zuul-core/src/main/java/com/netflix/zuul/stats/NamedCountingMonitor.java index cbc88ae83f..a49ea7637a 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/stats/NamedCountingMonitor.java +++ b/zuul-core/src/main/java/com/netflix/zuul/stats/NamedCountingMonitor.java @@ -65,6 +65,7 @@ public String getName() { /** * @return the current count */ + @Override public long getCount() { return this.count.get(); } diff --git a/zuul-core/src/main/java/com/netflix/zuul/stats/RouteStatusCodeMonitor.java b/zuul-core/src/main/java/com/netflix/zuul/stats/RouteStatusCodeMonitor.java index 9cd2e60ab0..0fa462f24f 100755 --- a/zuul-core/src/main/java/com/netflix/zuul/stats/RouteStatusCodeMonitor.java +++ b/zuul-core/src/main/java/com/netflix/zuul/stats/RouteStatusCodeMonitor.java @@ -87,6 +87,7 @@ public String getName() { return routeCode; } + @Override public long getCount() { return count.get(); } diff --git a/zuul-core/src/main/java/com/netflix/zuul/util/JsonUtility.java b/zuul-core/src/main/java/com/netflix/zuul/util/JsonUtility.java index 6b0b4f6f7c..18503efd34 100644 --- a/zuul-core/src/main/java/com/netflix/zuul/util/JsonUtility.java +++ b/zuul-core/src/main/java/com/netflix/zuul/util/JsonUtility.java @@ -138,6 +138,7 @@ public JsonDocument addValue(String key, String value) { return this; } + @Override public String toString() { return json.toString(); } diff --git a/zuul-groovy/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java b/zuul-groovy/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java index 25470ae7f2..07419c1630 100644 --- a/zuul-groovy/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java +++ b/zuul-groovy/src/main/java/com/netflix/zuul/groovy/GroovyCompiler.java @@ -39,6 +39,7 @@ public class GroovyCompiler implements DynamicCodeCompiler { * Compiles Groovy code and returns the Class of the compiles code. * */ + @Override public Class compile(String sCode, String sName) { GroovyClassLoader loader = getGroovyClassLoader(); LOG.warn("Compiling filter: {}", sName); @@ -57,6 +58,7 @@ GroovyClassLoader getGroovyClassLoader() { * Compiles groovy class from a file * */ + @Override public Class compile(File file) throws IOException { GroovyClassLoader loader = getGroovyClassLoader(); Class groovyClass = loader.parseClass(file); diff --git a/zuul-groovy/src/main/java/com/netflix/zuul/groovy/GroovyFileFilter.java b/zuul-groovy/src/main/java/com/netflix/zuul/groovy/GroovyFileFilter.java index 21b7132c9f..7653563ab1 100644 --- a/zuul-groovy/src/main/java/com/netflix/zuul/groovy/GroovyFileFilter.java +++ b/zuul-groovy/src/main/java/com/netflix/zuul/groovy/GroovyFileFilter.java @@ -22,6 +22,7 @@ * Filters only .groovy files */ public class GroovyFileFilter implements FilenameFilter { + @Override public boolean accept(File dir, String name) { return name.endsWith(".groovy"); } diff --git a/zuul-integration-test/src/test/java/com/netflix/zuul/integration/server/FilterLoaderProvider.java b/zuul-integration-test/src/test/java/com/netflix/zuul/integration/server/FilterLoaderProvider.java index 00966c0d38..1234ef08d5 100644 --- a/zuul-integration-test/src/test/java/com/netflix/zuul/integration/server/FilterLoaderProvider.java +++ b/zuul-integration-test/src/test/java/com/netflix/zuul/integration/server/FilterLoaderProvider.java @@ -46,6 +46,7 @@ public class FilterLoaderProvider implements Provider { FILTER_TYPES = Collections.unmodifiableSet(classes); } + @Override public FilterLoader get() { StaticFilterLoader loader = new StaticFilterLoader(new DefaultFilterFactory(), FILTER_TYPES); return loader;