From 478422cc21210a16d15e3316c15b87e4540d89bc Mon Sep 17 00:00:00 2001 From: Zach Kimberg Date: Tue, 16 Jan 2024 10:49:21 -0800 Subject: [PATCH] Suppress serial warning for JDK21 (#2935) * Suppress serial warning for JDK21 In JDK21, it now throws the serial warning for including potentially unserializable instance variables. This includes the standard Java data structures like List, Set, and Map. This changes the JDK21 support from https://github.com/deepjavalibrary/djl/pull/2903 to suppress the warning rather than no longer serializing the variables. * Keep CategoryMask as transient --- .../ai/djl/translate/PaddingStackBatchifier.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/api/src/main/java/ai/djl/translate/PaddingStackBatchifier.java b/api/src/main/java/ai/djl/translate/PaddingStackBatchifier.java index 359fe6bd7c5..f026bd431c9 100644 --- a/api/src/main/java/ai/djl/translate/PaddingStackBatchifier.java +++ b/api/src/main/java/ai/djl/translate/PaddingStackBatchifier.java @@ -29,10 +29,17 @@ public final class PaddingStackBatchifier implements Batchifier { private static final long serialVersionUID = 1L; - private transient List arraysToPad; - private transient List dimsToPad; + @SuppressWarnings("serial") + private List arraysToPad; + + @SuppressWarnings("serial") + private List dimsToPad; + private transient List paddingSuppliers; - private transient List paddingSizes; + + @SuppressWarnings("serial") + private List paddingSizes; + private boolean includeValidLengths; private PaddingStackBatchifier(Builder builder) {