Skip to content

Commit

Permalink
Suppress serial warning for JDK21 (#2935)
Browse files Browse the repository at this point in the history
* 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
#2903 to suppress the warning rather
than no longer serializing the variables.

* Keep CategoryMask as transient
  • Loading branch information
zachgk authored Jan 16, 2024
1 parent c69aeb6 commit 478422c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions api/src/main/java/ai/djl/translate/PaddingStackBatchifier.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,17 @@ public final class PaddingStackBatchifier implements Batchifier {

private static final long serialVersionUID = 1L;

private transient List<Integer> arraysToPad;
private transient List<Integer> dimsToPad;
@SuppressWarnings("serial")
private List<Integer> arraysToPad;

@SuppressWarnings("serial")
private List<Integer> dimsToPad;

private transient List<NDArraySupplier> paddingSuppliers;
private transient List<Integer> paddingSizes;

@SuppressWarnings("serial")
private List<Integer> paddingSizes;

private boolean includeValidLengths;

private PaddingStackBatchifier(Builder builder) {
Expand Down

0 comments on commit 478422c

Please sign in to comment.