From 1dc3d5d2d6a59d4dd3b03727422852b719f30b5b Mon Sep 17 00:00:00 2001 From: Brian Clozel Date: Fri, 9 Sep 2022 19:56:00 +0200 Subject: [PATCH] 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. --- .../main/java/org/springframework/http/HttpStatusCode.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spring-web/src/main/java/org/springframework/http/HttpStatusCode.java b/spring-web/src/main/java/org/springframework/http/HttpStatusCode.java index d92c89964e..ce048d12a6 100644 --- a/spring-web/src/main/java/org/springframework/http/HttpStatusCode.java +++ b/spring-web/src/main/java/org/springframework/http/HttpStatusCode.java @@ -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; * @see HTTP Status Code Registry * @see List of HTTP status codes - Wikipedia */ -public sealed interface HttpStatusCode permits DefaultHttpStatusCode, HttpStatus { +public sealed interface HttpStatusCode extends Serializable permits DefaultHttpStatusCode, HttpStatus { /** * Return the integer value of this status code.