This is an automated email from the ASF dual-hosted git repository.

ebourg pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/tomcat.git

commit 0b8b394241963e274e61c630c5ef5e9b191f2860
Author: Emmanuel Bourg <ebo...@apache.org>
AuthorDate: Fri Dec 4 00:48:39 2020 +0100

    Make the inner classes static when possible to save a reference to the 
enclosing class
---
 java/org/apache/catalina/realm/UserDatabaseRealm.java      |  2 +-
 java/org/apache/catalina/ssi/ExpressionParseTree.java      | 10 +++++-----
 java/org/apache/catalina/valves/rewrite/Substitution.java  | 14 +++++++-------
 java/org/apache/tomcat/websocket/WsFrameBase.java          |  2 +-
 .../catalina/authenticator/TestFormAuthenticator.java      |  2 +-
 .../apache/catalina/valves/rewrite/TestResolverSSL.java    |  2 +-
 test/org/apache/coyote/TestRequest.java                    |  2 +-
 test/org/apache/coyote/http2/Http2TestBase.java            |  2 +-
 test/org/apache/tomcat/util/net/TestSsl.java               |  2 +-
 9 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/java/org/apache/catalina/realm/UserDatabaseRealm.java 
b/java/org/apache/catalina/realm/UserDatabaseRealm.java
index b8aac01..4d055fd 100644
--- a/java/org/apache/catalina/realm/UserDatabaseRealm.java
+++ b/java/org/apache/catalina/realm/UserDatabaseRealm.java
@@ -307,7 +307,7 @@ public class UserDatabaseRealm extends RealmBase {
     }
 
 
-    private class UserDatabasePrincipal implements Principal {
+    private static class UserDatabasePrincipal implements Principal {
         private final String name;
         private UserDatabasePrincipal(String name) {
             this.name = name;
diff --git a/java/org/apache/catalina/ssi/ExpressionParseTree.java 
b/java/org/apache/catalina/ssi/ExpressionParseTree.java
index f32d08b..83da544 100644
--- a/java/org/apache/catalina/ssi/ExpressionParseTree.java
+++ b/java/org/apache/catalina/ssi/ExpressionParseTree.java
@@ -213,7 +213,7 @@ public class ExpressionParseTree {
     /**
      * A node in the expression parse tree.
      */
-    private abstract class Node {
+    private static abstract class Node {
         /**
          * @return {@code true} if the node evaluates to true.
          */
@@ -266,7 +266,7 @@ public class ExpressionParseTree {
     /**
      * A node implementation that represents an operation.
      */
-    private abstract class OppNode extends Node {
+    private static abstract class OppNode extends Node {
         /**
          * The left branch.
          */
@@ -295,7 +295,7 @@ public class ExpressionParseTree {
             left = values.remove(0);
         }
     }
-    private final class NotNode extends OppNode {
+    private static final class NotNode extends OppNode {
         @Override
         public boolean evaluate() {
             return !left.evaluate();
@@ -322,7 +322,7 @@ public class ExpressionParseTree {
             return left + " NOT";
         }
     }
-    private final class AndNode extends OppNode {
+    private static final class AndNode extends OppNode {
         @Override
         public boolean evaluate() {
             if (!left.evaluate()) // Short circuit
@@ -342,7 +342,7 @@ public class ExpressionParseTree {
             return left + " " + right + " AND";
         }
     }
-    private final class OrNode extends OppNode {
+    private static final class OrNode extends OppNode {
         @Override
         public boolean evaluate() {
             if (left.evaluate()) // Short circuit
diff --git a/java/org/apache/catalina/valves/rewrite/Substitution.java 
b/java/org/apache/catalina/valves/rewrite/Substitution.java
index a4191eb..26fc210 100644
--- a/java/org/apache/catalina/valves/rewrite/Substitution.java
+++ b/java/org/apache/catalina/valves/rewrite/Substitution.java
@@ -25,11 +25,11 @@ import org.apache.catalina.util.URLEncoder;
 
 public class Substitution {
 
-    public abstract class SubstitutionElement {
+    public static abstract class SubstitutionElement {
         public abstract String evaluate(Matcher rule, Matcher cond, Resolver 
resolver);
     }
 
-    public class StaticElement extends SubstitutionElement {
+    public static class StaticElement extends SubstitutionElement {
         public String value;
 
         @Override
@@ -59,7 +59,7 @@ public class Substitution {
         }
     }
 
-    public class RewriteCondBackReferenceElement extends SubstitutionElement {
+    public static class RewriteCondBackReferenceElement extends 
SubstitutionElement {
         public int n;
         @Override
         public String evaluate(Matcher rule, Matcher cond, Resolver resolver) {
@@ -67,7 +67,7 @@ public class Substitution {
         }
     }
 
-    public class ServerVariableElement extends SubstitutionElement {
+    public static class ServerVariableElement extends SubstitutionElement {
         public String key;
         @Override
         public String evaluate(Matcher rule, Matcher cond, Resolver resolver) {
@@ -75,7 +75,7 @@ public class Substitution {
         }
     }
 
-    public class ServerVariableEnvElement extends SubstitutionElement {
+    public static class ServerVariableEnvElement extends SubstitutionElement {
         public String key;
         @Override
         public String evaluate(Matcher rule, Matcher cond, Resolver resolver) {
@@ -83,7 +83,7 @@ public class Substitution {
         }
     }
 
-    public class ServerVariableSslElement extends SubstitutionElement {
+    public static class ServerVariableSslElement extends SubstitutionElement {
         public String key;
         @Override
         public String evaluate(Matcher rule, Matcher cond, Resolver resolver) {
@@ -91,7 +91,7 @@ public class Substitution {
         }
     }
 
-    public class ServerVariableHttpElement extends SubstitutionElement {
+    public static class ServerVariableHttpElement extends SubstitutionElement {
         public String key;
         @Override
         public String evaluate(Matcher rule, Matcher cond, Resolver resolver) {
diff --git a/java/org/apache/tomcat/websocket/WsFrameBase.java 
b/java/org/apache/tomcat/websocket/WsFrameBase.java
index 792dc8f..c4108fe 100644
--- a/java/org/apache/tomcat/websocket/WsFrameBase.java
+++ b/java/org/apache/tomcat/websocket/WsFrameBase.java
@@ -912,7 +912,7 @@ public abstract class WsFrameBase {
     protected abstract void resumeProcessing();
 
 
-    private abstract class TerminalTransformation implements Transformation {
+    private static abstract class TerminalTransformation implements 
Transformation {
 
         @Override
         public boolean validateRsvBits(int i) {
diff --git a/test/org/apache/catalina/authenticator/TestFormAuthenticator.java 
b/test/org/apache/catalina/authenticator/TestFormAuthenticator.java
index a743597..cc488d8 100644
--- a/test/org/apache/catalina/authenticator/TestFormAuthenticator.java
+++ b/test/org/apache/catalina/authenticator/TestFormAuthenticator.java
@@ -418,7 +418,7 @@ public class TestFormAuthenticator extends TomcatBaseTest {
      * Encapsulate the logic needed to run a suitably-configured tomcat
      * instance, send it an HTTP request and process the server response
      */
-    private abstract class FormAuthClientBase extends SimpleHttpClient {
+    private static abstract class FormAuthClientBase extends SimpleHttpClient {
 
         protected static final String LOGIN_PARAM_TAG = "action=";
         protected static final String LOGIN_RESOURCE = "j_security_check";
diff --git a/test/org/apache/catalina/valves/rewrite/TestResolverSSL.java 
b/test/org/apache/catalina/valves/rewrite/TestResolverSSL.java
index 389fd58..c1bede6 100644
--- a/test/org/apache/catalina/valves/rewrite/TestResolverSSL.java
+++ b/test/org/apache/catalina/valves/rewrite/TestResolverSSL.java
@@ -111,7 +111,7 @@ public class TestResolverSSL extends TomcatBaseTest {
             "SSL_SRP_USERINFO",
             "SSL_TLS_SNI" };
 
-    public class ResolverTestValve extends ValveBase {
+    public static class ResolverTestValve extends ValveBase {
 
         @Override
         public void invoke(Request request, Response response)
diff --git a/test/org/apache/coyote/TestRequest.java 
b/test/org/apache/coyote/TestRequest.java
index 018a8ee..f3b915e 100644
--- a/test/org/apache/coyote/TestRequest.java
+++ b/test/org/apache/coyote/TestRequest.java
@@ -135,7 +135,7 @@ public class TestRequest {
     }
 
 
-    private class DoNothingApplicationBufferHandler implements 
ApplicationBufferHandler {
+    private static class DoNothingApplicationBufferHandler implements 
ApplicationBufferHandler {
         @Override
         public void setByteBuffer(ByteBuffer buffer) {
 
diff --git a/test/org/apache/coyote/http2/Http2TestBase.java 
b/test/org/apache/coyote/http2/Http2TestBase.java
index 807c4a5..e15c444 100644
--- a/test/org/apache/coyote/http2/Http2TestBase.java
+++ b/test/org/apache/coyote/http2/Http2TestBase.java
@@ -594,7 +594,7 @@ public abstract class Http2TestBase extends TomcatBaseTest {
         }
     }
 
-    private class UpgradableHttp2Protocol extends Http2Protocol {
+    private static class UpgradableHttp2Protocol extends Http2Protocol {
         @Override
         public String getHttpUpgradeName(boolean isSSLEnabled) {
             return "h2c";
diff --git a/test/org/apache/tomcat/util/net/TestSsl.java 
b/test/org/apache/tomcat/util/net/TestSsl.java
index bb4c4eb..6e7f6c8 100644
--- a/test/org/apache/tomcat/util/net/TestSsl.java
+++ b/test/org/apache/tomcat/util/net/TestSsl.java
@@ -282,7 +282,7 @@ public class TestSsl extends TomcatBaseTest {
         }
     }
 
-    public class SimplePostServlet extends HttpServlet {
+    public static class SimplePostServlet extends HttpServlet {
 
         private static final long serialVersionUID = 1L;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to