Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress various serialization warnings #2876

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions vavr/src-gen/main/java/io/vavr/API.java
Original file line number Diff line number Diff line change
Expand Up @@ -5123,7 +5123,7 @@ public static final class Case0<T, R> implements Case<T, R> {
private static final long serialVersionUID = 1L;

private final Pattern0<T> pattern;
private final transient Function<? super T, ? extends R> f;
private transient final Function<? super T, ? extends R> f;

private Case0(Pattern0<T> pattern, Function<? super T, ? extends R> f) {
this.pattern = pattern;
Expand All @@ -5146,7 +5146,7 @@ public static final class Case1<T, T1, R> implements Case<T, R> {
private static final long serialVersionUID = 1L;

private final Pattern1<T, T1> pattern;
private final transient Function<? super T1, ? extends R> f;
private transient final Function<? super T1, ? extends R> f;

private Case1(Pattern1<T, T1> pattern, Function<? super T1, ? extends R> f) {
this.pattern = pattern;
Expand All @@ -5169,7 +5169,7 @@ public static final class Case2<T, T1, T2, R> implements Case<T, R> {
private static final long serialVersionUID = 1L;

private final Pattern2<T, T1, T2> pattern;
private final transient BiFunction<? super T1, ? super T2, ? extends R> f;
private transient final BiFunction<? super T1, ? super T2, ? extends R> f;

private Case2(Pattern2<T, T1, T2> pattern, BiFunction<? super T1, ? super T2, ? extends R> f) {
this.pattern = pattern;
Expand Down
2 changes: 2 additions & 0 deletions vavr/src/main/java/io/vavr/Lazy.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public final class Lazy<T> implements Value<T>, Supplier<T>, Serializable {

// read http://javarevisited.blogspot.de/2014/05/double-checked-locking-on-singleton-in-java.html
private transient volatile Supplier<? extends T> supplier;

@SuppressWarnings("serial") // Conditionally serializable
private T value; // will behave as a volatile in reality, because a supplier volatile read will update all fields (see https://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#volatile)

// should not be called directly
Expand Down
1 change: 1 addition & 0 deletions vavr/src/main/java/io/vavr/MatchError.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class MatchError extends NoSuchElementException {

private static final long serialVersionUID = 1L;

@SuppressWarnings("serial") // Conditionally serializable
private final Object obj;

/**
Expand Down
1 change: 1 addition & 0 deletions vavr/src/main/java/io/vavr/collection/JavaConverters.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ private static abstract class HasDelegate<C extends Traversable<?>> implements S

private static final long serialVersionUID = 1L;

@SuppressWarnings("serial") // Conditionally serializable
private C delegate;
private final boolean mutable;

Expand Down
1 change: 1 addition & 0 deletions vavr/src/main/java/io/vavr/control/Try.java
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,7 @@ final class Success<T> implements Try<T>, Serializable {

private static final long serialVersionUID = 1L;

@SuppressWarnings("serial") // Conditionally serializable
private final T value;

/**
Expand Down
2 changes: 2 additions & 0 deletions vavr/src/main/java/io/vavr/control/Validation.java
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ final class Valid<E, T> implements Validation<E, T>, Serializable {

private static final long serialVersionUID = 1L;

@SuppressWarnings("serial") // Conditionally serializable
private final T value;

/**
Expand Down Expand Up @@ -734,6 +735,7 @@ final class Invalid<E, T> implements Validation<E, T>, Serializable {

private static final long serialVersionUID = 1L;

@SuppressWarnings("serial") // Conditionally serializable
private final E error;

/**
Expand Down
Loading