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

Add @Serial annotation to all serialVersionUID fields #3584

Closed
wants to merge 1 commit into from
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,16 @@

import static com.querydsl.core.types.PathMetadataFactory.forVariable;

import java.io.Serial;

/**
* Query class for Country domain.
*
* @author Dmytro Iaroslavskyi
*/
public class QCountry extends EntityPathBase<Country> {

private static final long serialVersionUID = -936338527;
@Serial private static final long serialVersionUID = -936338527;

private static final PathInits INITS = PathInits.DIRECT2;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;

import java.io.Serial;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
Expand All @@ -39,7 +40,7 @@
*/
public class JpaSort extends Sort {

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

private JpaSort(Direction direction, List<Path<?, ?>> paths) {
this(Collections.<Order>emptyList(), direction, paths);
Expand Down Expand Up @@ -316,7 +317,7 @@ public String toString() {
*/
public static class JpaOrder extends Order {

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

private final boolean unsafe;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import jakarta.persistence.criteria.Predicate;
import jakarta.persistence.criteria.Root;

import java.io.Serial;
import java.io.Serializable;
import java.util.Arrays;
import java.util.stream.StreamSupport;
Expand All @@ -40,7 +41,7 @@
*/
public interface Specification<T> extends Serializable {

long serialVersionUID = 1L;
@Serial long serialVersionUID = 1L;

/**
* Negates the given {@link Specification}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.springframework.data.jpa.repository.query;

import java.io.Serial;

/**
* Signals that we encountered an invalid query method.
*
Expand All @@ -23,7 +25,7 @@
*/
public class InvalidJpaQueryMethodException extends RuntimeException {

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

/**
* Creates a new {@link InvalidJpaQueryMethodException} with the given message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import jakarta.persistence.criteria.Predicate;
import jakarta.persistence.criteria.Root;

import java.io.Serial;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -945,7 +946,7 @@ private static long executeCountQuery(TypedQuery<Long> query) {
@SuppressWarnings("rawtypes")
private static final class ByIdsSpecification<T> implements Specification<T> {

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

private final JpaEntityInformation<T, ?> entityInformation;

Expand Down Expand Up @@ -974,7 +975,7 @@ public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuild
*/
private static class ExampleSpecification<T> implements Specification<T> {

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

private final Example<T> example;
private final EscapeCharacter escapeCharacter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.springframework.data.jpa.domain.sample;

import java.io.Serial;

import jakarta.persistence.Entity;

import org.springframework.data.jpa.domain.AbstractPersistable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.jpa.domain.sample;

import java.io.Serial;
import java.io.Serializable;

import jakarta.persistence.Column;
Expand All @@ -25,7 +26,7 @@
*/
@Embeddable
public class EmbeddedIdExampleEmployeePK implements Serializable {
private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

@Column(nullable = false) private Long employeeId;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
*/
package org.springframework.data.jpa.domain.sample;

import java.io.Serial;
import java.io.Serializable;

/**
* @author Thomas Darimont
*/
public class IdClassExampleEmployeePK implements Serializable {
private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

private long empId;
private long department;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.jpa.domain.sample;

import java.io.Serial;
import java.io.Serializable;

/**
Expand All @@ -25,7 +26,7 @@
*/
public class ItemId implements Serializable {

private static final long serialVersionUID = -2986871112875450036L;
@Serial private static final long serialVersionUID = -2986871112875450036L;

private Integer id;
private Integer manufacturerId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.jpa.domain.sample;

import java.io.Serial;
import java.io.Serializable;

/**
Expand All @@ -25,7 +26,7 @@
*/
public class ItemSiteId implements Serializable {

private static final long serialVersionUID = 1822540289216799357L;
@Serial private static final long serialVersionUID = 1822540289216799357L;

private ItemId item;
private Integer site;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static org.springframework.util.ObjectUtils.*;

import java.io.Serial;
import java.io.Serializable;

/**
Expand All @@ -25,7 +26,7 @@
*/
public class PersistableWithIdClassPK implements Serializable {

private static final long serialVersionUID = 23126782341L;
@Serial private static final long serialVersionUID = 23126782341L;

private Long first;
private Long second;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,15 @@

import static org.springframework.util.ObjectUtils.*;

import java.io.Serial;
import java.io.Serializable;

/**
* @author Mark Paluch
*/
public class PersistableWithSingleIdClassPK implements Serializable {

private static final long serialVersionUID = 23126782341L;
@Serial private static final long serialVersionUID = 23126782341L;

private Long first;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/
package org.springframework.data.jpa.domain.sample;

import java.io.Serial;
import java.io.Serializable;

import jakarta.persistence.Column;
Expand All @@ -25,7 +26,7 @@
@Embeddable
public class SampleEntityPK implements Serializable {

private static final long serialVersionUID = 231060947L;
@Serial private static final long serialVersionUID = 231060947L;

@Column(nullable = false)
private String first;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.springframework.data.jpa.domain.sample;

import java.io.Serial;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
Expand All @@ -31,7 +33,7 @@
@Table
public class Site implements java.io.Serializable {

private static final long serialVersionUID = 1L;
@Serial private static final long serialVersionUID = 1L;

@Id @GeneratedValue Integer id;

Expand Down
Loading