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

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


The following commit(s) were added to refs/heads/master by this push:
     new f4f2c51  Add default methods for init() and destroy()
f4f2c51 is described below

commit f4f2c51cec753ed8e3d6cd555f264a1ba45596e4
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Tue May 12 19:36:58 2020 +0100

    Add default methods for init() and destroy()
    
    This aligns Tomcat with a recent change for Jakarta EE 9
    
    Signed-off-by: Mark Thomas <ma...@apache.org>
---
 java/jakarta/websocket/Decoder.java | 14 ++++++++++++--
 java/jakarta/websocket/Encoder.java | 14 ++++++++++++--
 webapps/docs/changelog.xml          |  9 +++++++++
 3 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/java/jakarta/websocket/Decoder.java 
b/java/jakarta/websocket/Decoder.java
index c8fa343..4f0a4e4 100644
--- a/java/jakarta/websocket/Decoder.java
+++ b/java/jakarta/websocket/Decoder.java
@@ -23,9 +23,19 @@ import java.nio.ByteBuffer;
 
 public interface Decoder {
 
-    abstract void init(EndpointConfig endpointConfig);
+    /**
+     * Initialise the decoder. The default implementation is a NO-OP.
+     *
+     * @param endpointConfig The end-point configuration
+     */
+    default void init(EndpointConfig endpointConfig) {
+    }
 
-    abstract void destroy();
+    /**
+     * Destroy the decoder. The default implementation is a NO-OP.
+     */
+    default void destroy() {
+    }
 
     interface Binary<T> extends Decoder {
 
diff --git a/java/jakarta/websocket/Encoder.java 
b/java/jakarta/websocket/Encoder.java
index 8b2c871..c201ae9 100644
--- a/java/jakarta/websocket/Encoder.java
+++ b/java/jakarta/websocket/Encoder.java
@@ -23,9 +23,19 @@ import java.nio.ByteBuffer;
 
 public interface Encoder {
 
-    abstract void init(EndpointConfig endpointConfig);
+    /**
+     * Initialise the encoder. The default implementation is a NO-OP.
+     *
+     * @param endpointConfig The end-point configuration
+     */
+    default void init(EndpointConfig endpointConfig) {
+    }
 
-    abstract void destroy();
+    /**
+     * Destroy the decoder. The default implementation is a NO-OP.
+     */
+    default void destroy() {
+    }
 
     interface Text<T> extends Encoder {
 
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index ee765e8..f6d1e43 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -52,6 +52,15 @@
       </update>
     </changelog>
   </subsection>
+  <subsection name="WebSopcket">
+    <changelog>
+      <add>
+        Add default implementations for <code>init()</code> and
+        <code>destroy()</code> to the <code>Encoder</code> and
+        <code>Decoder</code> interfaces. (markt)
+      </add>
+    </changelog>
+  </subsection>
 </section>
 <section name="Tomcat 10.0.0-M5 (markt)" rtext="2020-05-11">
   <subsection name="Catalina">


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

Reply via email to