Skip to content

Commit

Permalink
Suppress various serialization warnings (#2877)
Browse files Browse the repository at this point in the history
  • Loading branch information
pivovarit authored Oct 3, 2024
1 parent 61a9b47 commit 7fcf56d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
*
* @author Ruslan Sennov
*/
interface HashArrayMappedTrie<K, V> extends Iterable<Tuple2<K, V>> {
interface HashArrayMappedTrie<K, V> extends Iterable<Tuple2<K, V>>, Serializable {

static final long serialVersionUID = 1L;

static <K, V> HashArrayMappedTrie<K, V> empty() {
return EmptyNode.instance();
Expand Down Expand Up @@ -167,6 +169,8 @@ private static <K, V> AbstractNode<K, V> getChild(AbstractNode<K, V> node, int i
*/
abstract class AbstractNode<K, V> implements HashArrayMappedTrie<K, V> {

private static final long serialVersionUID = 1L;

static final int SIZE = 5;
static final int BUCKET_SIZE = 1 << SIZE;
static final int MAX_INDEX_NODE = BUCKET_SIZE >> 1;
Expand Down Expand Up @@ -330,6 +334,8 @@ private Object readResolve() {
*/
abstract class LeafNode<K, V> extends AbstractNode<K, V> {

private static final long serialVersionUID = 1L;

abstract K key();

abstract V value();
Expand Down
1 change: 1 addition & 0 deletions vavr/src/main/java/io/vavr/collection/List.java
Original file line number Diff line number Diff line change
Expand Up @@ -1803,6 +1803,7 @@ final class Cons<T> implements List<T>, Serializable {

private static final long serialVersionUID = 1L;

@SuppressWarnings("serial") // Conditionally serializable
private final T head;
private final List<T> tail;
private final int length;
Expand Down
2 changes: 2 additions & 0 deletions vavr/src/main/java/io/vavr/collection/PriorityQueue.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ public final class PriorityQueue<T> extends io.vavr.collection.AbstractQueue<T,

private static final long serialVersionUID = 1L;

@SuppressWarnings("serial") // Conditionally serializable
private final Comparator<? super T> comparator;
private final Seq<Node<T>> forest;
private final int size;
Expand Down Expand Up @@ -798,6 +799,7 @@ static final class Node<T> implements Serializable {

private static final long serialVersionUID = 1L;

@SuppressWarnings("serial") // Conditionally serializable
final T root;
final int rank;
final Seq<Node<T>> children;
Expand Down
1 change: 1 addition & 0 deletions vavr/src/main/java/io/vavr/collection/Stream.java
Original file line number Diff line number Diff line change
Expand Up @@ -1857,6 +1857,7 @@ abstract class Cons<T> implements Stream<T> {

private static final long serialVersionUID = 1L;

@SuppressWarnings("serial") // Conditionally serializable
final T head;
final Lazy<Stream<T>> tail;

Expand Down

0 comments on commit 7fcf56d

Please sign in to comment.