Browse Source

Make HttpStatusCode extend Serializable

`HttpStatusCode` instance only hold an int value and are held by
`Serializable` classes, so this commit enforces this.

Without this change, Java 19+ will emit a compiler warning as
`Serializable` classes use `HttpStatusCode` as a field.
pull/29136/head
Brian Clozel 2 years ago
parent
commit
1dc3d5d2d6
  1. 4
      spring-web/src/main/java/org/springframework/http/HttpStatusCode.java

4
spring-web/src/main/java/org/springframework/http/HttpStatusCode.java

@ -16,6 +16,8 @@ @@ -16,6 +16,8 @@
package org.springframework.http;
import java.io.Serializable;
import org.springframework.util.Assert;
/**
@ -27,7 +29,7 @@ import org.springframework.util.Assert; @@ -27,7 +29,7 @@ import org.springframework.util.Assert;
* @see <a href="https://www.iana.org/assignments/http-status-codes">HTTP Status Code Registry</a>
* @see <a href="https://en.wikipedia.org/wiki/List_of_HTTP_status_codes">List of HTTP status codes - Wikipedia</a>
*/
public sealed interface HttpStatusCode permits DefaultHttpStatusCode, HttpStatus {
public sealed interface HttpStatusCode extends Serializable permits DefaultHttpStatusCode, HttpStatus {
/**
* Return the integer value of this status code.

Loading…
Cancel
Save